From 38e2d5663aeb5ad9ca1811746e017092f5f620c8 Mon Sep 17 00:00:00 2001 From: SteveLauC Date: Mon, 16 Jun 2025 10:52:35 +0800 Subject: [PATCH] ci: fix pipeline relase to PyPI (#1176) --- .github/workflows/release_to_pypi.yml | 41 +++++++++++++++++---------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/.github/workflows/release_to_pypi.yml b/.github/workflows/release_to_pypi.yml index 11e5bc58..57811ec6 100644 --- a/.github/workflows/release_to_pypi.yml +++ b/.github/workflows/release_to_pypi.yml @@ -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-*/*