-
Notifications
You must be signed in to change notification settings - Fork 20
143 lines (126 loc) · 6.38 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
name: Build Keeper SDK for .NET
on:
# push:
# branches:
# - 'release_*'
workflow_dispatch:
inputs:
sqlite_storage:
description: Build SQLite Vault storage
type: boolean
required: false
default: false
cli:
description: Build CLI package
type: boolean
required: false
default: false
jobs:
build:
runs-on: windows-latest
steps:
- name: Setup product versions
run: |
$ErrorView = 'NormalView'
$branch = ($Env:GITHUB_REF -split '/')[2]
$comp = $branch -split '_'
$sdkVersion = $comp[1]
$packageVersion = $sdkVersion
if ($comp[2]) {
$packageVersion = $packageVersion + '-' + $comp[2]
}
$buildVersion = $sdkVersion + '.' + $Env:GITHUB_RUN_NUMBER
echo "SDK_VERSION=${sdkVersion}" >> $Env:GITHUB_ENV
echo "PACKAGE_VERSION=${packageVersion}" >> $Env:GITHUB_ENV
echo "BUILD_VERSION=${buildVersion}" >> $Env:GITHUB_ENV
shell: powershell
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- uses: microsoft/setup-msbuild@v2
- uses: nuget/setup-nuget@v2
- run: nuget restore KeeperSdk.sln
- name: Load signing certificate
run: |
if (Test-Path -Path certificate.txt) { Remove-Item certificate.txt }
if (Test-Path -Path certificate.pfx) { Remove-Item certificate.pfx }
Set-Content -Path certificate.txt -Value '${{ secrets.PFX_CERT }}'
certutil -decode certificate.txt certificate.pfx
Remove-Item certificate.txt
shell: powershell
- name: Build Keeper SDK Nuget package
working-directory: ./KeeperSdk
run: |
if (Test-Path bin) { Remove-Item -Force -Recurse bin }
dotnet build /P:Configuration=Release /P:Version=${Env:PACKAGE_VERSION} /P:AssemblyVersion=${Env:BUILD_VERSION} /P:FileVersion=${Env:BUILD_VERSION}
& 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe' sign /f ..\certificate.pfx /t "http://timestamp.digicert.com" /v /p "${{ secrets.PFX_PASS }}" /d ".NET Keeper SDK" "bin\Release\net452\KeeperSdk.dll"
& 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe' sign /f ..\certificate.pfx /t "http://timestamp.digicert.com" /v /p "${{ secrets.PFX_PASS }}" /d ".NET Keeper SDK" "bin\Release\netstandard2.0\KeeperSdk.dll"
dotnet pack --no-build --no-restore --no-dependencies /P:Configuration=Release /P:Version=${Env:PACKAGE_VERSION} /P:IncludeSymbols=true /P:SymbolPackageFormat=snupkg
shell: powershell
- name: Build SQLite Vault Storage
working-directory: ./OfflineStorageSqlite
run: |
if (Test-Path bin) { Remove-Item -Force -Recurse bin }
dotnet build --configuration=Release --no-dependencies
& 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe' sign /f ..\certificate.pfx /t "http://timestamp.digicert.com" /v /p "${{ secrets.PFX_PASS }}" /d ".NET Keeper SDK Offline SQLite Storage" "bin\Release\\netstandard2.0\OfflineStorageSqlite.dll"
dotnet pack --no-build --no-restore --configuration=Release /P:IncludeSymbols=true /P:SymbolPackageFormat=snupkg
shell: powershell
- name: Build CLI library
working-directory: ./Cli
run: |
if (Test-Path bin) { Remove-Item -Force -Recurse bin }
dotnet build --configuration=Release --no-dependencies
& 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe' sign /f ..\certificate.pfx /t "http://timestamp.digicert.com" /v /p "${{ secrets.PFX_PASS }}" /d ".NET Keeper SDK" "bin\Release\net472\Cli.dll"
& 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe' sign /f ..\certificate.pfx /t "http://timestamp.digicert.com" /v /p "${{ secrets.PFX_PASS }}" /d ".NET Keeper SDK" "bin\Release\netstandard2.0\Cli.dll"
dotnet pack --no-build --no-restore --no-dependencies --configuration=Release /P:IncludeSymbols=true /P:SymbolPackageFormat=snupkg
shell: powershell
- name: Build .Net Commander
working-directory: ./Commander
run: |
if (Test-Path bin) { Remove-Item -Force -Recurse bin }
msbuild /T:Restore /P:Configuration=Release
msbuild /T:Build /P:Configuration=Release /p:BuildProjectReferences=false
& 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe' sign /f ..\certificate.pfx /t "http://timestamp.digicert.com" /v /p "${{ secrets.PFX_PASS }}" /d ".NET Keeper SDK" "bin\Release\Commander.exe"
shell: powershell
- name: Zip Commander
run: |
$params = @{
Path = "Commander/bin/Release/*.exe", "Commander/bin/Release/Commander.exe.config", "Commander/bin/Release/*.dll", "OfflineStorageSqlite/bin/Release/netstandard2.0/OfflineStorageSqlite.dll"
CompressionLevel = "Fastest"
DestinationPath = "Commander-${Env:PACKAGE_VERSION}.zip"
}
Compress-Archive @params
shell: powershell
- name: Store SDK Nuget artifacts
uses: actions/upload-artifact@v4
with:
name: KeeperSdk-${{ env.PACKAGE_VERSION }}-Nuget-Package
path: |
KeeperSdk/bin/Release/Keeper.Sdk.${{ env.PACKAGE_VERSION }}.nupkg
KeeperSdk/bin/Release/Keeper.Sdk.${{ env.PACKAGE_VERSION }}.snupkg
retention-days: 1
- name: Store Commander artifacts
uses: actions/upload-artifact@v4
with:
name: Commander-${{ env.PACKAGE_VERSION }}
path: Commander-${{ env.PACKAGE_VERSION }}.zip
retention-days: 1
- name: Store SQLite Offline Storage artifacts
if: ${{ inputs.sqlite_storage }}
uses: actions/upload-artifact@v4
with:
name: OfflineStorageSqlite
path: |
OfflineStorageSqlite/bin/Release/Keeper.Storage.Sqlite.*.nupkg
OfflineStorageSqlite/bin/Release/Keeper.Storage.Sqlite.*.snupkg
retention-days: 1
- name: Store artifacts
if: ${{ inputs.cli }}
uses: actions/upload-artifact@v4
with:
name: Cli
path: |
Cli/bin/Release/Keeper.Cli.*.nupkg
Cli/bin/Release/Keeper.Cli.*.snupkg
retention-days: 1