From 7f04a700edce8606a8722a0b255f08b646a082d8 Mon Sep 17 00:00:00 2001 From: chinaheyu <810130242@qq.com> Date: Thu, 26 Dec 2024 20:30:23 +0800 Subject: [PATCH] update action pipeline --- .github/workflows/publish-to-pypi.yml | 49 ++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml index 88cd7f9..3146921 100644 --- a/.github/workflows/publish-to-pypi.yml +++ b/.github/workflows/publish-to-pypi.yml @@ -34,6 +34,7 @@ jobs: build_sdist: name: Build source distribution runs-on: ubuntu-latest + steps: - uses: actions/checkout@v4 - name: Build sdist @@ -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 @@ -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/gh-action-sigstore-python@v2.1.1 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 }}'