Build Keeper SDK for .NET #136
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |