Skip to content

Commit

Permalink
chore(ci): download files for second step, move attestation to final …
Browse files Browse the repository at this point in the history
…stage
  • Loading branch information
nathancartlidge committed May 3, 2024
1 parent ed33d8e commit 2245df8
Showing 1 changed file with 60 additions and 58 deletions.
118 changes: 60 additions & 58 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,70 +20,72 @@ jobs:
strategy:
matrix:
platform: [ x64 , ARM64 ]

runs-on: windows-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Read Version
run: |
echo "PLUGIN_VERSION=$(git describe --tags --dirty --candidates 1 --always)" >> $env:GITHUB_ENV
- name: Install .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Restore the application
run: dotnet restore
working-directory: src

- name: Execute unit tests
run: dotnet test
working-directory: src

- name: Build the application
run: dotnet build --configuration RELEASE /p:Platform=${{matrix.platform}} /p:EnableWindowsTargeting=true
working-directory: src

- name: Prepare the artifacts
run: |
Remove-Item -Path ${{ env.OUTPUT_PATH }}\* -Recurse -Include *.xml, *.pdb, PowerToys.*, Wox.*
Compress-Archive -Path ${{ env.OUTPUT_PATH }}\${{ matrix.platform }}\Release -DestinationPath "${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}-${{ matrix.platform }}.zip"
- name: Generate artifact attestations
uses: actions/attest-build-provenance@v1
with:
subject-path: ${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}-${{ matrix.platform }}.zip
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Read Version
run: |
echo "PLUGIN_VERSION=$(git describe --tags --dirty --candidates 1 --always)" >> $env:GITHUB_ENV
- name: Install .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Restore the application
run: dotnet restore
working-directory: src

- name: Execute unit tests
run: dotnet test
working-directory: src

- name: Build the application
run: dotnet build --configuration RELEASE /p:Platform=${{matrix.platform}} /p:EnableWindowsTargeting=true
working-directory: src

- name: Prepare the artifacts
run: |
Remove-Item -Path ${{ env.OUTPUT_PATH }}\* -Recurse -Include *.xml, *.pdb, PowerToys.*, Wox.*
Compress-Archive -Path ${{ env.OUTPUT_PATH }}\${{ matrix.platform }}\Release -DestinationPath "${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}-${{ matrix.platform }}.zip"
- name: Upload the artifact(s)
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.platform }}
path: ${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}-${{ matrix.platform }}.zip

release:
runs-on: windows-latest
needs: [build]

steps:
# unfortunately we have to redo these steps
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Read Version
run: |
echo "PLUGIN_VERSION=$(git describe --tags --dirty --candidates 1 --always)" >> $env:GITHUB_ENV
- name: Upload the artifact(s)
uses: actions/upload-artifact@v4
with:
name: ${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}.zip
path: ${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}-*.zip

- name: Create a release
uses: softprops/action-gh-release@v2
with:
draft: true
files: |
${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}-*.zip
# fetch artifacts from the previous step
- name: Download x64 build
uses: actions/download-artifact@v4
with:
name: x64

- name: Download ARM64 build
uses: actions/download-artifact@v4
with:
name: ARM64

# upload them
- name: Generate artifact attestations
uses: actions/attest-build-provenance@v1
with:
subject-path: ${{ env.PLUGIN_NAME }}-*.zip

- name: Create a release
uses: softprops/action-gh-release@v2
with:
draft: true
files: |
${{ env.PLUGIN_NAME }}-*.zip

0 comments on commit 2245df8

Please sign in to comment.