Skip to content

Commit

Permalink
Materialize signing key step as reusable action
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrzajac committed Oct 13, 2023
1 parent 2010467 commit 61ca914
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 17 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/actions/materialize-signing-key.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Materialize signing key
description: Materializes key to sign assemblies
outputs:
file-path:
description: "signing key file path"
value: ${{ steps.signing-key.outputs.PATH }}
env:
StrongNameKeyName: key.snk
defaults:
run:
shell: pwsh
runs:
using: "composite"
steps:
- name: 🖊️ materialize signing key
id: signing-key
run: |
$path = [IO.Path]::Combine("${{ github.workspace }}","src","${{ env.StrongNameKeyName }}")
[IO.File]::WriteAllBytes($path, [Convert]::FromBase64String("$env:StrongNameKey"))
"PATH=$path" >> $env:GITHUB_OUTPUT
env:
StrongNameKey: ${{ secrets.SIGNING_KEY }}
12 changes: 3 additions & 9 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ env:
DOTNET_CLI_TELEMETRY_OPTOUT: true
Configuration: Release
Namespace: Objectivity.AutoFixture.XUnit2
StrongNameKeyName: key.snk
CoverageDirectory: ${{ github.workspace }}\src\opencover

defaults:
Expand Down Expand Up @@ -93,18 +92,13 @@ jobs:
fetch-depth: 0
- name: 🖊️ materialize signing key
id: signing-key
run: |
$path = [IO.Path]::Combine("${{ github.workspace }}","src","${{ env.StrongNameKeyName }}")
[IO.File]::WriteAllBytes($path, [Convert]::FromBase64String("$env:StrongNameKey"))
"PATH=$path" >> $env:GITHUB_OUTPUT
env:
StrongNameKey: ${{ secrets.SIGNING_KEY }}
uses: actions/materialize-signing-key@reusable-actions
- name: 🏗️ build
run: dotnet build ./src/${{ env.Namespace }}.${{ matrix.package_module }}.sln
env:
CI: true
StrongNameKey: ${{ secrets.SIGNING_KEY }}
StrongNameKeyPath: ${{ steps.signing-key.outputs.PATH }}
StrongNameKeyPath: ${{ steps.signing-key.outputs.file-path }}
- name: 🧪 test Core in net7.0 & collect coverage
id: core-code-coverage
run: |
Expand Down Expand Up @@ -143,7 +137,7 @@ jobs:
env:
CI: true
StrongNameKey: ${{ secrets.SIGNING_KEY }}
StrongNameKeyPath: ${{ steps.signing-key.outputs.PATH }}
StrongNameKeyPath: ${{ steps.signing-key.outputs.file-path }}
- name: 🔼 upload packages
uses: actions/upload-artifact@v3
with:
Expand Down
10 changes: 2 additions & 8 deletions .github/workflows/test-mutations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
Configuration: Release
StrongNameKeyName: key.snk

defaults:
run:
Expand All @@ -35,12 +34,7 @@ jobs:
fetch-depth: 0
- name: 🖊️ materialize signing key
id: signing-key
run: |
$path = [IO.Path]::Combine("${{ github.workspace }}","src","${{ env.StrongNameKeyName }}")
[IO.File]::WriteAllBytes($path, [Convert]::FromBase64String("$env:StrongNameKey"))
"PATH=$path" >> $env:GITHUB_OUTPUT
env:
StrongNameKey: ${{ secrets.SIGNING_KEY }}
uses: actions/materialize-signing-key@reusable-actions
- name: 💾 install stryker.net
run: |
dotnet new tool-manifest
Expand All @@ -52,5 +46,5 @@ jobs:
env:
CI: true
StrongNameKey: ${{ secrets.SIGNING_KEY }}
StrongNameKeyPath: ${{ steps.signing-key.outputs.PATH }}
StrongNameKeyPath: ${{ steps.signing-key.outputs.file-path }}

0 comments on commit 61ca914

Please sign in to comment.