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