Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SLSA provenance to releases #262

Merged
merged 1 commit into from
Oct 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion .github/workflows/create-prerelease-on-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ on:
permissions:
contents: read
jobs:
build-release-publish:
build:
runs-on: ubuntu-latest
permissions:
actions: write
contents: write
outputs:
hashes: ${{ steps.hash.outputs.hashes }}
steps:
- uses: actions/checkout@v4

Expand All @@ -24,6 +26,12 @@ jobs:
run: npm run-script build -- --all --yomitan-version ${{ github.ref_name }}
shell: bash

- name: Generate hashes
id: hash
run: |
cd builds
echo "hashes=$(sha256sum * | base64 -w0)" >> "$GITHUB_OUTPUT"

- name: Release
id: release
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # [email protected]
Expand All @@ -46,3 +54,14 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
wait-for-completion: false
inputs: '{ "upload_url": "${{ steps.release.outputs.upload_url }}" }'

provenance:
needs: [build]
permissions:
actions: read # To read the workflow path.
id-token: write # To sign the provenance.
contents: write # To add assets to a release.
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@07e64b653f10a80b6510f4568f685f8b7b9ea830
with:
base64-subjects: "${{ needs.build.outputs.hashes }}"
upload-assets: true
20 changes: 19 additions & 1 deletion .github/workflows/publish-firefox-development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ on:
permissions:
contents: read
jobs:
build-signed-xpi-asset:
build:
runs-on: ubuntu-latest
environment: cd
permissions:
contents: write
outputs:
hashes: ${{ steps.hash.outputs.hashes }}
steps:
- uses: robinraju/release-downloader@efa4cd07bd0195e6cc65e9e30c251b49ce4d3e51 # [email protected]
with:
Expand All @@ -41,6 +43,11 @@ jobs:
steps.ffSignXpi.outputs.sameVersionAlreadyUploadedError != 'true'
run: exit 1

- name: Generate hashes
id: hash
run: |
echo "hashes=$(sha256sum yomitan-firefox-dev.xpi | base64 -w0)" >> "$GITHUB_OUTPUT"

- name: Upload offline xpi release asset
id: uploadReleaseAsset
if: steps.ffSignXpi.outcome == 'success'
Expand Down Expand Up @@ -86,3 +93,14 @@ jobs:
uses: ad-m/github-push-action@29f05e01bb17e6f28228b47437e03a7b69e1f9ef # pin@master
with:
branch: metadata

provenance:
needs: [build]
permissions:
actions: read # To read the workflow path.
id-token: write # To sign the provenance.
contents: write # To add assets to a release.
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@07e64b653f10a80b6510f4568f685f8b7b9ea830
with:
base64-subjects: "${{ needs.build.outputs.hashes }}"
upload-assets: true