Skip to content

Commit

Permalink
Generate provenance
Browse files Browse the repository at this point in the history
  • Loading branch information
fionn committed Dec 21, 2023
1 parent eacf3fd commit 6bc7eb1
Showing 1 changed file with 54 additions and 7 deletions.
61 changes: 54 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,14 @@ jobs:
run: python -m unittest -v --locals --buffer
working-directory: diode

publish:
build:

name: Publish
name: build
needs: [lint, test]
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
if: startsWith(github.ref, 'refs/tags')

outputs:
hashes: ${{ steps.hash.outputs.hashes }}

steps:

Expand All @@ -68,13 +67,61 @@ jobs:
PIP_DISABLE_PIP_VERSION_CHECK: 1

- name: Build distribution
run: make build
run: SOURCE_DATE_EPOCH="$(git show -s --format=%at)" make build

- name: Generate hashes
id: hash
run: echo "hashes=$(sha256sum * | base64 -w0)" >> $GITHUB_OUTPUT
working-directory: dist/

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: diode
path: dist/
if-no-files-found: error

provenance:

name: Provenance
needs: build
#if: startsWith(github.ref, 'refs/tags')

permissions:
actions: read
#contents: write
id-token: write

uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v1.9.0
with:
provenance-name: diode
base64-subjects: "${{ needs.build.outputs.hashes }}"
#upload-assets: true

publish:

name: Publish
needs: [build, provenance]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags')

environment: release
permissions:
id-token: write

steps:

- name: Download artifact
uses: actions/download-artifact@v4
with:
name: diode
path: dist/

- name: Upload to release
run: gh release upload ${{ github.ref_name }} * --repo ${{ github.repository }}
working-directory: dist/
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@v1.8
Expand Down

0 comments on commit 6bc7eb1

Please sign in to comment.