Skip to content

Commit

Permalink
[GitHub Actions] Generate artifact attestations to establish build pr…
Browse files Browse the repository at this point in the history
…ovenance
  • Loading branch information
past-due committed May 12, 2024
1 parent 2451786 commit ab9f711
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/CI_flatpak.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ jobs:
name: '${{ matrix.name }} (${{ matrix.arch }})'
permissions:
contents: read
# needed to generate artifact attestations, see: https://docs.github.com/en/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds
id-token: write
attestations: write
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
env:
Expand Down Expand Up @@ -264,6 +267,13 @@ jobs:
path: |
output_debug_dependency_snapshot
if-no-files-found: 'error'
- name: Generate artifact attestation
# Run on push to master branch (development build), or tag release automation build
if: success() && ((github.event_name == 'push' && github.ref == 'refs/heads/master') || (github.event_name == 'workflow_run' && github.event.workflow_run.name == 'Draft Tag Release'))
uses: actions/attest-build-provenance@v1
continue-on-error: true
with:
subject-path: '${{ steps.settings.outputs.WZ_FLATPAK_BUNDLE }}'
###############################################################
# Package the ostree repo (for use in later publish-release-to-flathub job)
- name: Tar ostree repo
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/CI_macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@ jobs:
name: 'Package Universal Binary'
permissions:
contents: write # Needed to upload to releases
# needed to generate artifact attestations, see: https://docs.github.com/en/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds
id-token: write
attestations: write
needs: macos-build
runs-on: macos-latest
steps:
Expand Down Expand Up @@ -295,6 +298,13 @@ jobs:
name: "warzone2100_macOS_universal"
path: ${{ env.WZ_FULL_OUTPUT_ZIP_PATH }}
if-no-files-found: 'error'
- name: 'Generate artifact attestation - (full)'
# Run on push to master branch (development build), or tag release automation build
if: success() && ((github.event_name == 'push' && github.ref == 'refs/heads/master') || (github.event_name == 'workflow_run' && github.event.workflow_run.name == 'Draft Tag Release'))
uses: actions/attest-build-provenance@v1
continue-on-error: true
with:
subject-path: '${{ env.WZ_FULL_OUTPUT_ZIP_PATH }}'
- name: Upload "universal" to release
if: success() && (github.event_name == 'workflow_run' && github.event.workflow_run.name == 'Draft Tag Release') && (github.repository == 'Warzone2100/warzone2100')
run: |
Expand Down Expand Up @@ -353,6 +363,13 @@ jobs:
name: "warzone2100_macOS_universal_novideos"
path: ${{ env.WZ_FULL_OUTPUT_ZIP_PATH }}
if-no-files-found: 'error'
- name: 'Generate artifact attestation - (novideos)'
# Run on push to master branch (development build), or tag release automation build
if: success() && ((github.event_name == 'push' && github.ref == 'refs/heads/master') || (github.event_name == 'workflow_run' && github.event.workflow_run.name == 'Draft Tag Release'))
uses: actions/attest-build-provenance@v1
continue-on-error: true
with:
subject-path: '${{ env.WZ_FULL_OUTPUT_ZIP_PATH }}'
- name: Upload "universal_novideos" to release
if: success() && (github.event_name == 'workflow_run' && github.event.workflow_run.name == 'Draft Tag Release') && (github.repository == 'Warzone2100/warzone2100')
run: |
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/CI_snapcraft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ jobs:
name: '${{ matrix.name }}'
permissions:
contents: write # Needed to upload to releases
# needed to generate artifact attestations, see: https://docs.github.com/en/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds
id-token: write
attestations: write
runs-on: ubuntu-20.04 # Use instead of ubuntu-latest until https://github.com/snapcore/action-build/issues/42 is resolved
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
Expand Down Expand Up @@ -118,6 +121,13 @@ jobs:
name: 'warzone2100_linux_${{ matrix.arch }}_snap'
path: '${{ env.WZ_FULL_OUTPUT_SNAP_PATH }}'
if-no-files-found: 'error'
- name: Generate artifact attestation
# Run on push to master branch (development build), or tag release automation build
if: success() && ((github.event_name == 'push' && github.ref == 'refs/heads/master') || (github.event_name == 'workflow_run' && github.event.workflow_run.name == 'Draft Tag Release'))
uses: actions/attest-build-provenance@v1
continue-on-error: true
with:
subject-path: '${{ env.WZ_FULL_OUTPUT_SNAP_PATH }}'
- name: Upload artifact to release
if: success() && (github.event_name == 'workflow_run' && github.event.workflow_run.name == 'Draft Tag Release')
run: |
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/CI_ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ jobs:
name: '${{ matrix.name }}'
permissions:
contents: write # Needed to upload to releases
# needed to generate artifact attestations, see: https://docs.github.com/en/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds
id-token: write
attestations: write
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
outputs:
Expand Down Expand Up @@ -195,6 +198,13 @@ jobs:
path: |
${{ github.workspace }}/debug
if-no-files-found: 'error'
- name: Generate artifact attestation
# Run on push to master branch (development build), or tag release automation build
if: success() && (matrix.publish_artifact == true) && ((github.event_name == 'push' && github.ref == 'refs/heads/master') || (github.event_name == 'workflow_run' && github.event.workflow_run.name == 'Draft Tag Release'))
uses: actions/attest-build-provenance@v1
continue-on-error: true
with:
subject-path: '${{ env.WZ_FULL_OUTPUT_DEB_PATH }}'
- name: Upload artifact to release
if: success() && (github.event_name == 'workflow_run' && github.event.workflow_run.name == 'Draft Tag Release') && (matrix.deploy_release == true)
run: |
Expand All @@ -209,6 +219,9 @@ jobs:
name: Package Source (Ubuntu 22.04) [GCC]
permissions:
contents: write # Needed to upload to releases
# needed to generate artifact attestations, see: https://docs.github.com/en/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds
id-token: write
attestations: write
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
Expand Down Expand Up @@ -279,6 +292,13 @@ jobs:
name: warzone2100_src
path: ${{ env.OUTPUT_DIR }}
if-no-files-found: 'error'
- name: Generate artifact attestation
# Run on push to master branch (development build), or tag release automation build
if: success() && ((github.event_name == 'push' && github.ref == 'refs/heads/master') || (github.event_name == 'workflow_run' && github.event.workflow_run.name == 'Draft Tag Release'))
uses: actions/attest-build-provenance@v1
continue-on-error: true
with:
subject-path: '${{ env.OUTPUT_DIR }}/warzone2100_src.tar.xz'
- name: Upload source tarball to release
if: success() && (github.event_name == 'workflow_run' && github.event.workflow_run.name == 'Draft Tag Release')
run: |
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/CI_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ jobs:
name: '${{ matrix.architecture }} [${{ matrix.compiler }}]'
permissions:
contents: write # Needed to upload to releases
# needed to generate artifact attestations, see: https://docs.github.com/en/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds
id-token: write
attestations: write
runs-on: windows-2022
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
Expand Down Expand Up @@ -680,6 +683,30 @@ jobs:
path: '${{ github.workspace }}\output\archive'
if-no-files-found: 'error'
#####################################################
# Generate artifact attestations
#####################################################
- name: 'Generate artifact attestation - (Portable Build)'
# Run on push to master branch (development build), or tag release automation build
if: success() && ((github.event_name == 'push' && github.ref == 'refs/heads/master') || (github.event_name == 'workflow_run' && github.event.workflow_run.name == 'Draft Tag Release'))
uses: actions/attest-build-provenance@v1
continue-on-error: true
with:
subject-path: '${{ github.workspace }}\output\portable\*'
- name: 'Generate artifact attestation - (Regular Installer)'
# Run on push to master branch (development build), or tag release automation build
if: success() && ((github.event_name == 'push' && github.ref == 'refs/heads/master') || (github.event_name == 'workflow_run' && github.event.workflow_run.name == 'Draft Tag Release'))
uses: actions/attest-build-provenance@v1
continue-on-error: true
with:
subject-path: '${{ github.workspace }}\output\installer\*'
- name: 'Generate artifact attestation - (Archive)'
# Run on push to master branch (development build), or tag release automation build
if: success() && ((github.event_name == 'push' && github.ref == 'refs/heads/master') || (github.event_name == 'workflow_run' && github.event.workflow_run.name == 'Draft Tag Release'))
uses: actions/attest-build-provenance@v1
continue-on-error: true
with:
subject-path: '${{ github.workspace }}\output\archive\*'
#####################################################
# Upload Release assets (if a release tag)
#####################################################
- name: Upload Release Assets
Expand Down

0 comments on commit ab9f711

Please sign in to comment.