From 7e59537b17dd13c723f4471ccc6db1200be5a1e0 Mon Sep 17 00:00:00 2001 From: pizzaboxer Date: Mon, 14 Oct 2024 00:44:15 +0100 Subject: [PATCH] Split CI action into two Needed because the code signing action requires knowing the artifact upload ID, which as far as I know, is impossible to obtain under a matrix --- .github/workflows/ci-debug.yml | 30 +++++ .github/workflows/{ci.yml => ci-release.yml} | 128 +++++++++---------- 2 files changed, 92 insertions(+), 66 deletions(-) create mode 100644 .github/workflows/ci-debug.yml rename .github/workflows/{ci.yml => ci-release.yml} (62%) diff --git a/.github/workflows/ci-debug.yml b/.github/workflows/ci-debug.yml new file mode 100644 index 0000000..3c290ac --- /dev/null +++ b/.github/workflows/ci-debug.yml @@ -0,0 +1,30 @@ +name: CI (Debug) +on: [push, pull_request] + +jobs: + build: + runs-on: windows-latest + + steps: + - uses: actions/checkout@v4 + with: + submodules: true + + - uses: actions/setup-dotnet@v4 + with: + dotnet-version: '6.0.x' + + - name: Restore dependencies + run: dotnet restore + + - name: Build + run: dotnet build --no-restore + + - name: Publish + run: dotnet publish -p:PublishSingleFile=true -p:CommitHash=${{ github.sha }} -p:CommitRef=${{ github.ref_type }}/${{ github.ref_name }} -r win-x64 -c Debug --self-contained false .\Bloxstrap\Bloxstrap.csproj + + - name: Upload Artifact + uses: actions/upload-artifact@v4 + with: + name: Bloxstrap (Debug) (${{ github.sha }}) + path: .\Bloxstrap\bin\Debug\net6.0-windows\win-x64\publish\* \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci-release.yml similarity index 62% rename from .github/workflows/ci.yml rename to .github/workflows/ci-release.yml index 266605f..93e6498 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci-release.yml @@ -1,66 +1,62 @@ -name: CI -on: [push, pull_request] - -jobs: - build: - strategy: - matrix: - configuration: [Debug, Release] - - runs-on: windows-latest - - steps: - - uses: actions/checkout@v4 - with: - submodules: true - - - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '6.0.x' - - - name: Restore dependencies - run: dotnet restore - - - name: Build - run: dotnet build --no-restore - - - name: Publish - run: dotnet publish -p:PublishSingleFile=true -p:CommitHash=${{ github.sha }} -p:CommitRef=${{ github.ref_type }}/${{ github.ref_name }} -r win-x64 -c ${{ matrix.configuration }} --self-contained false .\Bloxstrap\Bloxstrap.csproj - - - name: Upload Artifact - id: upload-artifact-${{ matrix.configuration }} - uses: actions/upload-artifact@v4 - with: - name: Bloxstrap (${{ matrix.configuration }}) - path: | - .\Bloxstrap\bin\${{ matrix.configuration }}\net6.0-windows\win-x64\publish\* - - release: - needs: build - runs-on: ubuntu-latest - if: startsWith(github.ref, 'refs/tags/v') - - steps: - - name: Sign and download release artifact - uses: signpath/github-action-submit-signing-request@v1 - with: - api-token: '${{ secrets.SIGNPATH_API_TOKEN }}' - organization-id: '107b3de5-057b-42fc-a985-3546e4261775' - project-slug: 'bloxstrap' - signing-policy-slug: 'release-signing' - artifact-configuration-slug: 'github-ci' - github-artifact-id: '${{ steps.upload-artifact-Release.outputs.artifact-id }}' - wait-for-completion: true - output-artifact-directory: 'release' - - - name: Rename binaries - run: | - mv release/Bloxstrap.exe Bloxstrap-${{ github.ref_name }}.exe - - - name: Release - uses: softprops/action-gh-release@v2 - with: - draft: true - files: | - Bloxstrap-${{ github.ref_name }}.exe - name: Bloxstrap ${{ github.ref_name }} +name: CI (Release) +on: [push, pull_request] + +jobs: + build: + runs-on: windows-latest + + outputs: + artifact-id: ${{ steps.upload-artifact.outputs.artifact-id }} + + steps: + - uses: actions/checkout@v4 + with: + submodules: true + + - uses: actions/setup-dotnet@v4 + with: + dotnet-version: '6.0.x' + + - name: Restore dependencies + run: dotnet restore + + - name: Build + run: dotnet build --no-restore + + - name: Publish + run: dotnet publish -p:PublishSingleFile=true -p:CommitHash=${{ github.sha }} -p:CommitRef=${{ github.ref_type }}/${{ github.ref_name }} -r win-x64 -c Release --self-contained false .\Bloxstrap\Bloxstrap.csproj + + - name: Upload Artifact + id: upload-artifact + uses: actions/upload-artifact@v4 + with: + name: Bloxstrap (Release) (${{ github.sha }}) + path: .\Bloxstrap\bin\Release\net6.0-windows\win-x64\publish\* + + release: + needs: build + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/v') + + steps: + - name: Sign and download artifact + uses: signpath/github-action-submit-signing-request@v1 + with: + api-token: '${{ secrets.SIGNPATH_API_TOKEN }}' + organization-id: '107b3de5-057b-42fc-a985-3546e4261775' + project-slug: 'bloxstrap' + signing-policy-slug: 'release-signing' + artifact-configuration-slug: 'github-ci' + github-artifact-id: '${{ needs.build.outputs.artifact-id }}' + wait-for-completion: true + output-artifact-directory: 'release' + + - name: Rename binaries + run: mv release/Bloxstrap.exe Bloxstrap-${{ github.ref_name }}.exe + + - name: Create release + uses: softprops/action-gh-release@v2 + with: + draft: true + files: Bloxstrap-${{ github.ref_name }}.exe + name: Bloxstrap ${{ github.ref_name }}