Skip to content

Commit

Permalink
update action pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
chinaheyu committed Dec 26, 2024
1 parent b2de52f commit 7f04a70
Showing 1 changed file with 48 additions and 1 deletion.
49 changes: 48 additions & 1 deletion .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Build sdist
Expand All @@ -44,9 +45,16 @@ jobs:
path: dist/*.tar.gz

publish-to-pypi:
name: Publish Python distribution to PyPI
if: startsWith(github.ref, 'refs/tags/')
needs: [build_linux_wheels, build_windows_wheels, build_sdist]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/cv2-enumerate-cameras
permissions:
id-token: write

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
Expand All @@ -57,5 +65,44 @@ jobs:

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

github-release:
name: Sign the Python distribution with Sigstore and upload them to GitHub Release
needs:
- publish-to-pypi
runs-on: ubuntu-latest

permissions:
contents: write
id-token: write

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/

- name: Sign the dists with Sigstore
uses: sigstore/[email protected]
with:
password: ${{ secrets.PYPI_API_TOKEN }}
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release create
'${{ github.ref_name }}'
--repo '${{ github.repository }}'
--notes ""
- name: Upload artifact signatures to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release upload
'${{ github.ref_name }}' dist/**
--repo '${{ github.repository }}'

0 comments on commit 7f04a70

Please sign in to comment.