Bump version to v0.3.6 (#334) #284
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - master | |
| tags: | |
| - "*" | |
| pull_request: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| validate_tag_version: | |
| name: Validate tag version alignment | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Ensure tag version matches rust/Cargo.toml | |
| shell: bash | |
| run: | | |
| python scripts/validate_tag_version.py | |
| linux: | |
| needs: [validate_tag_version] | |
| runs-on: ${{ matrix.platform.runner }} | |
| strategy: | |
| matrix: | |
| platform: | |
| - runner: ubuntu-22.04 | |
| target: x86_64 | |
| - runner: ubuntu-22.04 | |
| target: x86 | |
| - runner: ubuntu-22.04 | |
| target: aarch64 | |
| # - runner: ubuntu-22.04 | |
| # target: armv7 | |
| # - runner: ubuntu-22.04 | |
| # target: ppc64le | |
| python_version: ["3.9", "3.10", "3.11", "3.12"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python_version }} | |
| - id: version | |
| name: Resolve package version | |
| shell: bash | |
| run: | | |
| VERSION="$(python scripts/resolve_release_version.py)" | |
| echo "version=${VERSION}" >> "${GITHUB_OUTPUT}" | |
| echo "Resolved version: ${VERSION}" | |
| - name: Apply package version | |
| shell: bash | |
| env: | |
| VERSION: ${{ steps.version.outputs.version }} | |
| run: | | |
| python - <<'PY' | |
| import os | |
| import re | |
| from pathlib import Path | |
| version = os.environ["VERSION"] | |
| cargo_toml = Path("rust/Cargo.toml") | |
| text = cargo_toml.read_text() | |
| pattern = r'(^\[package\][\s\S]*?^version\s*=\s*)"[^"]+"' | |
| new_text, count = re.subn( | |
| pattern, | |
| lambda m: f'{m.group(1)}"{version}"', | |
| text, | |
| count=1, | |
| flags=re.MULTILINE, | |
| ) | |
| if count != 1: | |
| raise SystemExit("Failed to update [package] version in rust/Cargo.toml") | |
| cargo_toml.write_text(new_text) | |
| print(f"Updated rust/Cargo.toml version to {version}") | |
| PY | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| target: ${{ matrix.platform.target }} | |
| args: --release --out dist -i python${{ matrix.python_version }} | |
| sccache: "true" | |
| manylinux: auto | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-${{ matrix.python_version }}-linux-${{ matrix.platform.target }} | |
| path: dist | |
| # musllinux: | |
| # runs-on: ${{ matrix.platform.runner }} | |
| # strategy: | |
| # matrix: | |
| # platform: | |
| # - runner: ubuntu-22.04 | |
| # target: x86_64 | |
| # - runner: ubuntu-22.04 | |
| # target: x86 | |
| # - runner: ubuntu-22.04 | |
| # target: aarch64 | |
| # - runner: ubuntu-22.04 | |
| # target: armv7 | |
| # steps: | |
| # - uses: actions/checkout@v4 | |
| # - uses: actions/setup-python@v5 | |
| # with: | |
| # python-version: 3.x | |
| # - name: Build wheels | |
| # uses: PyO3/maturin-action@v1 | |
| # with: | |
| # target: ${{ matrix.platform.target }} | |
| # args: --release --out dist --interpreter ${{ matrix.python_version }} | |
| # sccache: 'true' | |
| # manylinux: musllinux_1_2 | |
| # - name: Upload wheels | |
| # uses: actions/upload-artifact@v4 | |
| # with: | |
| # name: wheels-musllinux-${{ matrix.platform.target }} | |
| # path: dist | |
| windows: | |
| needs: [validate_tag_version] | |
| runs-on: ${{ matrix.platform.runner }} | |
| strategy: | |
| matrix: | |
| platform: | |
| - runner: windows-latest | |
| target: x64 | |
| python_arch: x64 | |
| - runner: windows-latest | |
| target: x86 | |
| python_arch: x86 | |
| python_version: ["3.9", "3.10", "3.11", "3.12"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python_version }} | |
| architecture: ${{ matrix.platform.python_arch }} | |
| - id: version | |
| name: Resolve package version | |
| shell: bash | |
| run: | | |
| VERSION="$(python scripts/resolve_release_version.py)" | |
| echo "version=${VERSION}" >> "${GITHUB_OUTPUT}" | |
| echo "Resolved version: ${VERSION}" | |
| - name: Apply package version | |
| shell: bash | |
| env: | |
| VERSION: ${{ steps.version.outputs.version }} | |
| run: | | |
| python - <<'PY' | |
| import os | |
| import re | |
| from pathlib import Path | |
| version = os.environ["VERSION"] | |
| cargo_toml = Path("rust/Cargo.toml") | |
| text = cargo_toml.read_text() | |
| pattern = r'(^\[package\][\s\S]*?^version\s*=\s*)"[^"]+"' | |
| new_text, count = re.subn( | |
| pattern, | |
| lambda m: f'{m.group(1)}"{version}"', | |
| text, | |
| count=1, | |
| flags=re.MULTILINE, | |
| ) | |
| if count != 1: | |
| raise SystemExit("Failed to update [package] version in rust/Cargo.toml") | |
| cargo_toml.write_text(new_text) | |
| print(f"Updated rust/Cargo.toml version to {version}") | |
| PY | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| target: ${{ matrix.platform.target }} | |
| args: --release --out dist -i python | |
| sccache: "true" | |
| manylinux: auto | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-${{ matrix.python_version }}-windows-${{ matrix.platform.target }} | |
| path: dist | |
| macos: | |
| needs: [validate_tag_version] | |
| runs-on: ${{ matrix.platform.runner }} | |
| strategy: | |
| matrix: | |
| platform: | |
| - runner: macos-latest | |
| target: x86_64 | |
| - runner: macos-latest | |
| target: aarch64 | |
| python_version: ["3.9", "3.10", "3.11", "3.12"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python_version }} | |
| - id: version | |
| name: Resolve package version | |
| shell: bash | |
| run: | | |
| VERSION="$(python scripts/resolve_release_version.py)" | |
| echo "version=${VERSION}" >> "${GITHUB_OUTPUT}" | |
| echo "Resolved version: ${VERSION}" | |
| - name: Apply package version | |
| shell: bash | |
| env: | |
| VERSION: ${{ steps.version.outputs.version }} | |
| run: | | |
| python - <<'PY' | |
| import os | |
| import re | |
| from pathlib import Path | |
| version = os.environ["VERSION"] | |
| cargo_toml = Path("rust/Cargo.toml") | |
| text = cargo_toml.read_text() | |
| pattern = r'(^\[package\][\s\S]*?^version\s*=\s*)"[^"]+"' | |
| new_text, count = re.subn( | |
| pattern, | |
| lambda m: f'{m.group(1)}"{version}"', | |
| text, | |
| count=1, | |
| flags=re.MULTILINE, | |
| ) | |
| if count != 1: | |
| raise SystemExit("Failed to update [package] version in rust/Cargo.toml") | |
| cargo_toml.write_text(new_text) | |
| print(f"Updated rust/Cargo.toml version to {version}") | |
| PY | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| target: ${{ matrix.platform.target }} | |
| args: --release --out dist -i python | |
| sccache: "true" | |
| manylinux: auto | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-${{ matrix.python_version }}-macos-${{ matrix.platform.target }} | |
| path: dist | |
| sdist: | |
| needs: [validate_tag_version] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - id: version | |
| name: Resolve package version | |
| shell: bash | |
| run: | | |
| VERSION="$(python scripts/resolve_release_version.py)" | |
| echo "version=${VERSION}" >> "${GITHUB_OUTPUT}" | |
| echo "Resolved version: ${VERSION}" | |
| - name: Apply package version | |
| shell: bash | |
| env: | |
| VERSION: ${{ steps.version.outputs.version }} | |
| run: | | |
| python - <<'PY' | |
| import os | |
| import re | |
| from pathlib import Path | |
| version = os.environ["VERSION"] | |
| cargo_toml = Path("rust/Cargo.toml") | |
| text = cargo_toml.read_text() | |
| pattern = r'(^\[package\][\s\S]*?^version\s*=\s*)"[^"]+"' | |
| new_text, count = re.subn( | |
| pattern, | |
| lambda m: f'{m.group(1)}"{version}"', | |
| text, | |
| count=1, | |
| flags=re.MULTILINE, | |
| ) | |
| if count != 1: | |
| raise SystemExit("Failed to update [package] version in rust/Cargo.toml") | |
| cargo_toml.write_text(new_text) | |
| print(f"Updated rust/Cargo.toml version to {version}") | |
| PY | |
| - name: Build sdist | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| command: sdist | |
| args: --out dist | |
| - name: Upload sdist | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-sdist | |
| path: dist | |
| test_release: | |
| name: Test Release | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event_name != 'pull_request' }} | |
| environment: release | |
| needs: [linux, macos, windows, 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@v4 | |
| - name: Generate artifact attestation | |
| uses: actions/attest-build-provenance@v1 | |
| with: | |
| subject-path: "wheels-*/*" | |
| # - name: Display structure of downloaded files | |
| # run: ls -R | |
| - name: Create 'wheels' directory | |
| run: mkdir -p wheels | |
| - name: Copy wheels artifacts | |
| run: | | |
| find wheels-* -type f -name "*.whl" -exec cp {} wheels/ \; | |
| - name: Publish package distributions to Test PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| repository-url: https://test.pypi.org/legacy/ | |
| packages-dir: wheels/ | |
| skip-existing: true | |
| verbose: true | |
| release: | |
| name: Release | |
| runs-on: ubuntu-latest | |
| environment: release | |
| if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }} | |
| needs: [linux, macos, windows, 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@v4 | |
| - name: Generate artifact attestation | |
| uses: actions/attest-build-provenance@v1 | |
| with: | |
| subject-path: "wheels-*/*" | |
| - name: Create 'wheels' directory | |
| run: mkdir -p wheels | |
| - name: Copy wheels artifacts | |
| run: | | |
| find wheels-* -type f -name "*.whl" -exec cp {} wheels/ \; | |
| - name: Publish package distributions to Test PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| packages-dir: wheels/ | |
| skip-existing: true | |
| verbose: true |