[CI]Add unsafe artifacts for pull request actions check #64
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Modified from https://github.com/actions/starter-workflows/blob/main/ci/dotnet-desktop.yml | |
name: Build artifacts | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
workflow_call: | |
jobs: | |
build: | |
runs-on: ${{matrix.os}} | |
strategy: | |
fail-fast: false | |
matrix: | |
runtime: [ "win-x64", "osx-arm64", "linux-x64" ] | |
include: | |
- runtime: "win-x64" | |
os: "windows-latest" | |
- runtime: "osx-arm64" | |
os: "macos-latest" | |
- runtime: "linux-x64" | |
os: "ubuntu-latest" | |
permissions: | |
id-token: write | |
contents: read | |
attestations: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install .NET Core | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Build the application | |
run: dotnet publish --configuration Release -r ${{ matrix.runtime }} | |
- name: Move artifacts - Windows | |
if: runner.os == 'Windows' | |
shell: pwsh | |
run: Move-Item -Path TuneLab\bin\Release\net8.0\${{ matrix.runtime }}\publish -Destination workspace | |
- name: Move artifacts - MacOS and Linux | |
if: runner.os != 'Windows' | |
run: mv TuneLab/bin/Release/net8.0/${{ matrix.runtime }}/publish workspace | |
- name: Generate artifact attestation - Windows | |
if: runner.os == 'Windows' && github.event_name != 'pull_request' | |
uses: actions/attest-build-provenance@v1 | |
with: | |
subject-path: '"workspace/*.dll","workspace/*.exe"' | |
- name: Generate artifact attestation - MacOS and Linux | |
if: runner.os != 'Windows' && github.event_name != 'pull_request' | |
uses: actions/attest-build-provenance@v1 | |
with: | |
subject-path: '"workspace/*.dll","workspace/ExtensionInstaller","workspace/TuneLab"' | |
- name: Get short SHA | |
uses: benjlevesque/[email protected] | |
id: short-sha | |
with: | |
length: 7 | |
- name: Upload artifacts | |
if: github.event_name != 'pull_request' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: TuneLab-${{ matrix.runtime }}-${{ steps.short-sha.outputs.sha }} | |
path: workspace | |
- name: Upload artifacts (Not signed) | |
if: github.event_name == 'pull_request' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: TuneLab-${{ matrix.runtime }}-${{ steps.short-sha.outputs.sha }}-Unsafe | |
path: workspace | |