From 35eb57fe474587c741e0eaea83eac3dd0f720683 Mon Sep 17 00:00:00 2001 From: Stanislaw Kem Date: Sat, 21 Feb 2026 13:41:07 +0100 Subject: [PATCH] Patch Cargo version from tag --- .github/workflows/publish.yml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 33cf04f..d013165 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -15,7 +15,7 @@ permissions: jobs: test: name: Run pytest - runs-on: macos-14 + runs-on: macos-15 env: RUSTFLAGS: -C link-arg=-L/usr/lib/swift -C link-arg=-Wl,-rpath,/usr/lib/swift UV_CACHE_DIR: .uv-cache @@ -71,12 +71,25 @@ jobs: strategy: fail-fast: false matrix: - os: [macos-14] + os: [macos-15] python-version: ["3.11"] steps: - uses: actions/checkout@v4 + - name: Patch Cargo.toml version from tag + if: ${{ startsWith(github.ref, 'refs/tags/v') }} + run: | + TAG="${GITHUB_REF_NAME}" + VERSION="${TAG#v}" + if [ "$VERSION" = "$TAG" ]; then + echo "Tag must start with 'v', got: $TAG" >&2 + exit 1 + fi + sed -i.bak -E "s/^version = \".*\"$/version = \"${VERSION}\"/" Cargo.toml + rm -f Cargo.toml.bak + grep -n '^version = ' Cargo.toml + - name: Install native build deps run: | brew update @@ -92,7 +105,7 @@ jobs: args: --release --target universal2-apple-darwin --out dist - name: Build sdist - if: matrix.os == 'macos-14' + if: matrix.os == 'macos-15' uses: PyO3/maturin-action@v1 with: command: sdist