From 26729c359a12dfbb698b297c8e7cb2f6b40b5679 Mon Sep 17 00:00:00 2001 From: Sem Date: Sat, 12 Oct 2024 16:05:56 +0200 Subject: [PATCH] Update CI.yml --- .github/workflows/CI.yml | 43 +++++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 9f0095a..fd50121 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -16,6 +16,7 @@ on: permissions: contents: read + id-token: write jobs: linux: @@ -40,6 +41,10 @@ jobs: - uses: actions/setup-python@v5 with: python-version: 3.x + - name: Update version + if: "startsWith(github.ref, 'refs/tags/')" + run: + sed 's/version = ".*"/version = "${{ github.ref_name }}"/' Cargo.toml - name: Build wheels uses: PyO3/maturin-action@v1 with: @@ -71,6 +76,10 @@ jobs: - uses: actions/setup-python@v5 with: python-version: 3.x + - name: Update version + if: "startsWith(github.ref, 'refs/tags/')" + run: + sed 's/version = ".*"/version = "${{ github.ref_name }}"/' Cargo.toml - name: Build wheels uses: PyO3/maturin-action@v1 with: @@ -99,6 +108,10 @@ jobs: with: python-version: 3.x architecture: ${{ matrix.platform.target }} + - name: Update version + if: "startsWith(github.ref, 'refs/tags/')" + run: + sed 's/version = ".*"/version = "${{ github.ref_name }}"/' Cargo.toml - name: Build wheels uses: PyO3/maturin-action@v1 with: @@ -125,6 +138,10 @@ jobs: - uses: actions/setup-python@v5 with: python-version: 3.x + - name: Update version + if: "startsWith(github.ref, 'refs/tags/')" + run: + sed 's/version = ".*"/version = "${{ github.ref_name }}"/' Cargo.toml - name: Build wheels uses: PyO3/maturin-action@v1 with: @@ -152,17 +169,15 @@ jobs: name: wheels-sdist path: dist -# release: -# name: Release -# runs-on: ubuntu-latest -# if: "startsWith(github.ref, 'refs/tags/')" -# needs: [linux, musllinux, windows, macos, sdist] -# 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-*/* + release: + name: Release + runs-on: ubuntu-latest + if: "startsWith(github.ref, 'refs/tags/')" + needs: [linux, musllinux, windows, macos, sdist] + steps: + - uses: actions/download-artifact@v4 + - name: Publish to PyPI + uses: PyO3/maturin-action@v1 + with: + command: upload + args: --non-interactive --skip-existing wheels-*/*