Skip to content

Commit

Permalink
KSM-360 .Net SDK GHA to build and release strong named assemblies
Browse files Browse the repository at this point in the history
  • Loading branch information
idimov-keeper committed Feb 2, 2024
1 parent d262b7f commit c63b3c6
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/publish.nuget.strong.named.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Publish strong-named assemblies to NuGet

on:
workflow_dispatch:

jobs:
publish-nuget:
environment: prod
runs-on: ubuntu-latest

defaults:
run:
shell: bash
working-directory: ./sdk/dotNet

steps:
- name: Get the source code
uses: actions/checkout@v4

- name: Setup .NET 6
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x

- name: Retrieve secrets from KSM
id: ksmsecrets
uses: Keeper-Security/ksm-action@master
with:
keeper-secret-config: ${{ secrets.KSM_KSM_CONFIG }}
secrets: |
Sq4nnb5HXXNp1l6KryXynw/field/password > NUGET_AUTH_TOKEN
AAAAAAAAAAAAAAAAAAAAAA/file/sgKSM.snk > file:${{ github.workspace }}/sdk/dotNet/SecretsManager/sgKSM.snk
- name: Install dependencies
run: dotnet restore

- name: Build
run: dotnet build --configuration Release --no-restore -p:SignKSM=True

- name: Cleanup temp files
run: rm -f ./SecretsManager/sgKSM.snk

- name: Publish package
run: dotnet nuget push ./SecretsManager/bin/Release/*.nupkg --api-key ${{steps.ksmsecrets.outputs.NUGET_AUTH_TOKEN}} --source https://api.nuget.org/v3/index.json
5 changes: 5 additions & 0 deletions sdk/dotNet/SecretsManager/SecretsManager.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,9 @@
<PackageReference Include="System.Text.Json" Version="8.0.0" />
<PackageReference Include="System.Text.Encodings.Web" Version="8.0.0" />
</ItemGroup>

<PropertyGroup Condition="'$(SignKSM)'=='True'">
<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile>sgKSM.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
</Project>

0 comments on commit c63b3c6

Please sign in to comment.