diff --git a/.github/actions/materialize-signing-key/action.yml b/.github/actions/materialize-signing-key/action.yml new file mode 100644 index 00000000..dd244b58 --- /dev/null +++ b/.github/actions/materialize-signing-key/action.yml @@ -0,0 +1,26 @@ +name: Materialize signing key +description: Materializes key to sign assemblies +inputs: + signing-key-value: + description: Value of the signing key + required: true + signing-key-file-name: + description: Name of the signing key file + required: false + default: key.snk +outputs: + file-path: + description: Signing key file path + value: ${{ steps.signing-key.outputs.PATH }} +runs: + using: composite + steps: + - name: ๐Ÿ–Š๏ธ materialize signing key + id: signing-key + run: | + $path = [IO.Path]::Combine("${{ github.workspace }}","src","${{ inputs.signing-key-file-name }}") + [IO.File]::WriteAllBytes($path, [Convert]::FromBase64String("$env:StrongNameKey")) + "PATH=$path" >> $env:GITHUB_OUTPUT + shell: pwsh + env: + StrongNameKey: ${{ inputs.signing-key-value }} diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 13fd2684..e3c1fd2e 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -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: @@ -93,18 +92,15 @@ 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: ./.github/actions/materialize-signing-key + with: + signing-key-value: ${{ secrets.SIGNING_KEY }} - 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: | @@ -143,7 +139,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: diff --git a/.github/workflows/test-mutations.yml b/.github/workflows/test-mutations.yml index c170d1bd..cd216d89 100644 --- a/.github/workflows/test-mutations.yml +++ b/.github/workflows/test-mutations.yml @@ -19,7 +19,6 @@ env: DOTNET_NOLOGO: true DOTNET_CLI_TELEMETRY_OPTOUT: true Configuration: Release - StrongNameKeyName: key.snk defaults: run: @@ -35,12 +34,9 @@ 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: ./.github/actions/materialize-signing-key + with: + signing-key-value: ${{ secrets.SIGNING_KEY }} - name: ๐Ÿ’พ install stryker.net run: | dotnet new tool-manifest @@ -52,5 +48,5 @@ jobs: env: CI: true StrongNameKey: ${{ secrets.SIGNING_KEY }} - StrongNameKeyPath: ${{ steps.signing-key.outputs.PATH }} + StrongNameKeyPath: ${{ steps.signing-key.outputs.file-path }}