Skip to content

Commit

Permalink
Fix bump version action
Browse files Browse the repository at this point in the history
  • Loading branch information
torymur committed Feb 18, 2025
1 parent 616178d commit 279b640
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 53 deletions.
57 changes: 17 additions & 40 deletions .github/actions/bump_version/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: 'Bump Versions'
description: 'This action bumps versions of Cargo.toml file, matching release tag'
# This action is called from PyPi and Rust release workflows to update Cargo.toml with release version.
# It will only be successfull, if release tag, which triggered the workflow will match
# package version in Cargo.toml (sanity check).
name: 'Update package version to release version'
description: 'This action bumps package version in Cargo.toml file, matching the release tag.'

runs:
using: 'composite'
Expand All @@ -9,44 +12,18 @@ runs:
with:
fetch-depth: 0

# - name: Fetch all tags explicitly
# run: git fetch --tags
# shell: bash

# - name: Get all tags
# run: git tag
# shell: bash

# - name: Get latest
# run: git describe --tags --abbrev=0 2> /dev/null
# shell: bash
#
# - name: Get the exact Git tag or latest tag + dev
# run: |
# tag=$(git describe --exact-match --tags 2>&1) || {
# echo "Error: No exact match tag found."
# tag=""
# }
# # If no exact match tag found, get the latest tag or set default
# if [ -z "$tag" ]; then
# version="0.0.0"
# else
# version="$tag"
# fi
# echo "Version: $version"
# echo "version=$version" >> $GITHUB_ENV
# shell: bash

- name: Bump Cargo version
# TODO: update once wheels confirmed
- name: Bump version in Cargo.toml
run: |
# python .github/actions/bump_version/cargo_version_bumper.py --target Cargo.toml "${{ github.ref_name }}"
python .github/actions/bump_version/cargo_version_bumper.py --target Cargo.toml "0.2.3"
# python .github/actions/bump_version/bump_version.py --target Cargo.toml "${{ github.ref_name }}"
python .github/actions/bump_version/bump_version.py --target Cargo.toml "0.2.3"
shell: bash

# - name: Check Cargo.toml version matches Release tag
# run: |
# CARGO_VERSION=$(grep '^version =' Cargo.toml | sed 's/.*"\(.*\)".*/\1/')
# if [ "${GITHUB_REF#refs/tags/}" != "$CARGO_VERSION" ]; then
# echo "Version mismatch: Cargo.toml ($CARGO_VERSION) doesn't match Release tag (${GITHUB_REF#refs/tags/})"
# exit 1
# fi
# - name: Check version in Cargo.toml matches Release tag
# run: |
# VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[0].version')
# if [ "${GITHUB_REF#refs/tags/}" != "$VERSION" ]; then
# echo "Version mismatch: Cargo.toml ($VERSION) doesn't match Release tag (${GITHUB_REF#refs/tags/})"
# exit 1
# fi
# shell: bash
24 changes: 12 additions & 12 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@ jobs:
sudo apt update
sudo apt install pkg-config gcc-aarch64-linux-gnu g++-aarch64-linux-gnu -qy
- name: Bump Cargo version
if: ${{ inputs.auto_bump }}
uses: ./.github/actions/bump_version

- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
target: ${{ matrix.platform.target}}-unknown-linux-gnu
- uses: Swatinem/rust-cache@v2

- name: Bump version in Cargo.toml
if: ${{ inputs.auto_bump }}
uses: ./.github/actions/bump_version

- name: Build wheels
uses: PyO3/maturin-action@v1
with:
Expand Down Expand Up @@ -105,16 +105,16 @@ jobs:
run: |
choco install nasm
- name: Bump Cargo version
if: ${{ inputs.auto_bump }}
uses: ./.github/actions/bump_version

- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
target: ${{ matrix.platform.alias-target}}
- uses: Swatinem/rust-cache@v2

- name: Bump version in Cargo.toml
if: ${{ inputs.auto_bump }}
uses: ./.github/actions/bump_version

- name: Build wheels
uses: PyO3/maturin-action@v1
with:
Expand Down Expand Up @@ -172,16 +172,16 @@ jobs:
- name: Set macOS version
run: echo "MACOSX_DEPLOYMENT_TARGET=${{ matrix.platform.macos_version }}" >> $GITHUB_ENV

- name: Bump Cargo version
if: ${{ inputs.auto_bump }}
uses: ./.github/actions/bump_version

- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
target: ${{ matrix.platform.target}}-apple-darwin
- uses: Swatinem/rust-cache@v2

- name: Bump version in Cargo.toml
if: ${{ inputs.auto_bump }}
uses: ./.github/actions/bump_version

- name: Build wheels
uses: PyO3/maturin-action@v1
with:
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ __pycache__
.idea
.pytest_cache
.venv
*_version.py
*.egg-info
*.gguf
*.pyd
Expand Down

0 comments on commit 279b640

Please sign in to comment.