Skip to content

Commit

Permalink
Fix signing with sigstore
Browse files Browse the repository at this point in the history
PyPI does not accept sigstore signatures. Attach them to GH release
instead.

Signed-off-by: Christian Heimes <[email protected]>
  • Loading branch information
tiran committed Apr 25, 2024
1 parent 63ac34e commit 31f8506
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions .github/workflows/pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ on:
release:
types:
- published
workflow_dispatch:

permissions:
contents: read
Expand All @@ -39,7 +38,6 @@ jobs:
if: |
github.repository_owner == 'tiran' && (
github.event.action == 'published' ||
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'push' && github.ref == 'refs/heads/main')
)
runs-on: ubuntu-latest
Expand All @@ -62,10 +60,7 @@ jobs:
# environment: publish-pypi
# TODO: move to instructlab
if: |
github.repository_owner == 'tiran' && (
github.event.action == 'published' ||
github.event_name == 'workflow_dispatch'
)
github.repository_owner == 'tiran' && github.event.action == 'published'
runs-on: ubuntu-latest
needs: build-package

Expand All @@ -78,10 +73,21 @@ jobs:

- uses: sigstore/[email protected]
with:
upload-signing-artifact: true
upload-signing-artifacts: true
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Upload artifact signatures to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release upload '${{ github.ref_name }}' dist/* --repo '${{ github.repository }}'
# PyPI does not accept .sigstore artifacts and
# gh-action-pypi-publish has no option to ignore them.
- name: Remove sigstore signatures before uploading to PyPI
run: rm ./dist/*.sigstore

- name: Upload to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

0 comments on commit 31f8506

Please sign in to comment.