ci: fix pipeline relase to PyPI (#1176)

This commit is contained in:
SteveLauC
2025-06-16 10:52:35 +08:00
committed by GitHub
parent 3db95a3e67
commit 38e2d5663a

View File

@@ -3,6 +3,7 @@ name: Update PyPi
on: on:
release: release:
types: [published] types: [published]
workflow_dispatch:
permissions: permissions:
contents: read contents: read
@@ -20,12 +21,12 @@ jobs:
with: with:
target: ${{ matrix.target }} target: ${{ matrix.target }}
args: --release --out dist args: --release --out dist
sccache: 'true' sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
manylinux: auto manylinux: auto
- name: Upload wheels - name: Upload wheels
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v4
with: with:
name: wheels name: wheels-linux-${{ matrix.platform.target }}
path: dist path: dist
windows: windows:
@@ -40,11 +41,11 @@ jobs:
with: with:
target: ${{ matrix.target }} target: ${{ matrix.target }}
args: --release --out dist args: --release --out dist
sccache: 'true' sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
- name: Upload wheels - name: Upload wheels
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v4
with: with:
name: wheels name: wheels-windows-${{ matrix.platform.target }}
path: dist path: dist
macos: macos:
@@ -59,11 +60,11 @@ jobs:
with: with:
target: ${{ matrix.target }} target: ${{ matrix.target }}
args: --release --out dist args: --release --out dist
sccache: 'true' sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
- name: Upload wheels - name: Upload wheels
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v4
with: with:
name: wheels name: wheels-macos-${{ matrix.platform.target }}
path: dist path: dist
sdist: sdist:
@@ -76,24 +77,34 @@ jobs:
command: sdist command: sdist
args: --out dist args: --out dist
- name: Upload sdist - name: Upload sdist
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v4
with: with:
name: wheels name: wheels-sdist
path: dist path: dist
release: release:
name: Release name: Release
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/')"
needs: [linux, windows, macos, sdist] needs: [linux, windows, macos, sdist]
permissions:
# Use to sign the release artifacts
id-token: write
# Used to upload release artifacts
contents: write
# Used to generate artifact attestation
attestations: write
steps: steps:
- uses: actions/download-artifact@v3 - uses: actions/download-artifact@v4
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v2
with: with:
name: wheels subject-path: 'wheels-*/*'
- name: Publish to PyPI - name: Publish to PyPI
uses: PyO3/maturin-action@v1 uses: PyO3/maturin-action@v1
env: env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
with: with:
command: upload command: upload
args: --skip-existing * args: --non-interactive --skip-existing wheels-*/*