From bb4712db8061503eca90e5a79941bf1593b669dc Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Sun, 8 Sep 2024 19:42:05 +0200 Subject: [PATCH] Fix Python CI Release job now use PyPI's trusted publishing. --- .github/workflows/python.yml | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index dbc0dcb..29bb1ee 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -6,13 +6,9 @@ name: Python wrapping on: - push: - branches: - - main - tags: - - '*' pull_request: - workflow_dispatch: + release: + types: [released] permissions: contents: read @@ -25,13 +21,14 @@ jobs: platform: - runner: ubuntu-latest steps: - - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: '3.10' - name: Install dependencies run: | sudo apt-get install -y libfuse-dev + - name: Checkout code + uses: actions/checkout@v4 - name: Build wheels uses: PyO3/maturin-action@v1 with: @@ -42,7 +39,7 @@ jobs: - name: Upload wheels uses: actions/upload-artifact@v4 with: - name: wheels-linux + name: wheels-linux-x86_64 path: dist windows: @@ -52,10 +49,11 @@ jobs: platform: - runner: windows-latest steps: - - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: '3.10' + - name: Checkout code + uses: actions/checkout@v4 - name: Build wheels uses: PyO3/maturin-action@v1 with: @@ -65,7 +63,7 @@ jobs: - name: Upload wheels uses: actions/upload-artifact@v4 with: - name: wheels-windows + name: wheels-windows-x64 path: dist macos: @@ -75,13 +73,14 @@ jobs: platform: - runner: macos-latest steps: - - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: '3.10' - name: Install dependencies run: | brew install macfuse + - name: Checkout code + uses: actions/checkout@v4 - name: Build wheels uses: PyO3/maturin-action@v1 with: @@ -91,13 +90,14 @@ jobs: - name: Upload wheels uses: actions/upload-artifact@v4 with: - name: wheels-macos + name: wheels-macos-x86_64 path: dist sdist: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - name: Checkout code + uses: actions/checkout@v4 - name: Build sdist uses: PyO3/maturin-action@v1 with: @@ -113,15 +113,14 @@ jobs: release: name: Release runs-on: ubuntu-latest - if: "startsWith(github.ref, 'refs/tags/')" - needs: [sdist] + if: "github.event_name == 'release'" + needs: [linux, windows, macos, sdist] + permissions: + id-token: write steps: - uses: actions/download-artifact@v4 - name: Publish to PyPI uses: PyO3/maturin-action@v1 - env: - MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} with: command: upload args: --non-interactive --skip-existing wheels-*/* - working-directory: python