Demo 14 - Build Attestations #17
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
name: Demo 14 - Build Attestations | |
on: workflow_dispatch | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
dotnet-version: '8.0' | |
# if you use ANY permissions in yaml, you must include all permissions | |
permissions: | |
# for checkout | |
contents: read | |
# you must include thess permission to use the action/attest-build-provenance@v1 action | |
id-token: write | |
attestations: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: ${{ env.dotnet-version }} | |
- name: Restore dependencies | |
run: dotnet restore src/MyClassLibrary/MyClassLibrary.csproj | |
- name: Build | |
run: dotnet build --configuration Release src/MyClassLibrary/MyClassLibrary.csproj | |
- name: Create staging directory | |
run: mkdir -p ./staging | |
- name: Copy DLL to staging directory | |
run: cp ./src/MyClassLibrary/bin/Release/net${{env.dotnet-version}}/MyClassLibrary.dll ./staging/ | |
- name: Attest build provenance | |
uses: actions/attest-build-provenance@v1 | |
with: | |
# Specify the path to the folder you want to attest | |
subject-path: staging/MyClassLibrary.dll | |