Merge pull request #80 from A-MAIN/master #310
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 | |
shell: pwsh | |
working-directory: ${{github.workspace}} | |
run: Move-Item -Path "TuneLab\bin\Release\net8.0\${{ matrix.runtime }}\publish" -Destination "workspace\" | |
- name: Copy license to artifacts path | |
shell: pwsh | |
working-directory: ${{github.workspace}} | |
run: Copy-Item "LICENSE.txt" -Destination "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: Find executable and dynamic library files - MacOS and Linux | |
if: runner.os != 'Windows' && github.event_name != 'pull_request' | |
id: find-executable-files | |
shell: bash | |
working-directory: ${{github.workspace}} | |
run: | | |
find ./CIUtils/ -name "*.sh" -exec chmod +x {} \; | |
EXEC_FILES=$(./CIUtils/find-executable.sh "workspace/") | |
echo "Found executable and dynamic library files: $EXEC_FILES" | |
echo "exec_files=$EXEC_FILES" >> $GITHUB_OUTPUT | |
- 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",${{ steps.find-executable-files.outputs.exec_files }}' | |
- 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 | |