Skip to content

Commit

Permalink
#15 Add provence
Browse files Browse the repository at this point in the history
  • Loading branch information
sofusalbertsen committed Mar 7, 2023
1 parent f9d6ea4 commit 5ee1bbc
Showing 1 changed file with 83 additions and 0 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/make-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Package and upload a release

on:
push:
branches: [main]

jobs:
# This step builds our artifacts, uploads them to the workflow run, and
# outputs their digest.
build:
outputs:
hashes: ${{ steps.hash.outputs.hashes }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: package artifacts
run: |
# These are some amazing artifacts.
zip -r frontend.zip frontend/
zip -r backend.zip backend/
- name: Generate hashes
shell: bash
id: hash
run: |
# sha256sum generates sha256 hash for all artifacts.
# base64 -w0 encodes to base64 and outputs on a single line.
# sha256sum frontend.zip backend.zip ... | base64 -w0
echo "hashes=$(sha256sum frontend.zip backend.zip | base64 -w0)" >> "$GITHUB_OUTPUT"
- name: Upload Frontend
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # tag=v3.1.0
with:
name: frontend
path: frontend.zip
if-no-files-found: error
retention-days: 5

- name: Upload backend
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # tag=v3.1.0
with:
name: backend
path: backend.zip
if-no-files-found: error
retention-days: 5

# This step calls the generic workflow to generate provenance.
provenance:
needs: [build]
permissions:
actions: read
id-token: write
contents: write
uses: slsa-framework/slsa-github-generator/.github/workflows/[email protected]
with:
base64-subjects: "${{ needs.build.outputs.hashes }}"
# Upload provenance to a new release
upload-assets: true

# This step uploads our artifacts to the tagged GitHub release.
release:
needs: [build, provenance]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download frontend
uses: actions/download-artifact@fb598a63ae348fa914e94cd0ff38f362e927b741 # tag=v2.1.0
with:
name: frontend

- name: Download backend
uses: actions/download-artifact@fb598a63ae348fa914e94cd0ff38f362e927b741 # tag=v2.1.0
with:
name: backend

- name: Upload assets
uses: softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5 # v0.1.14
with:
files: |
frontend.zip
backend.zip

0 comments on commit 5ee1bbc

Please sign in to comment.