Skip to content

Commit d142ff0

Browse files
committed
Fix bump version action
1 parent 970cf71 commit d142ff0

File tree

4 files changed

+27
-53
lines changed

4 files changed

+27
-53
lines changed
Lines changed: 15 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
name: 'Bump Versions'
2-
description: 'This action bumps versions of Cargo.toml file, matching release tag'
1+
# This action is called from PyPi and Rust release workflows to update Cargo.toml with release version.
2+
# It will only be successfull, if release tag, which triggered the workflow will match
3+
# package version in Cargo.toml (sanity check).
4+
name: 'Update package version to release version'
5+
description: 'This action bumps package version in Cargo.toml file, matching the release tag.'
36

47
runs:
58
using: 'composite'
@@ -9,44 +12,16 @@ runs:
912
with:
1013
fetch-depth: 0
1114

12-
# - name: Fetch all tags explicitly
13-
# run: git fetch --tags
14-
# shell: bash
15-
16-
# - name: Get all tags
17-
# run: git tag
18-
# shell: bash
19-
20-
# - name: Get latest
21-
# run: git describe --tags --abbrev=0 2> /dev/null
22-
# shell: bash
23-
#
24-
# - name: Get the exact Git tag or latest tag + dev
25-
# run: |
26-
# tag=$(git describe --exact-match --tags 2>&1) || {
27-
# echo "Error: No exact match tag found."
28-
# tag=""
29-
# }
30-
# # If no exact match tag found, get the latest tag or set default
31-
# if [ -z "$tag" ]; then
32-
# version="0.0.0"
33-
# else
34-
# version="$tag"
35-
# fi
36-
# echo "Version: $version"
37-
# echo "version=$version" >> $GITHUB_ENV
38-
# shell: bash
39-
40-
- name: Bump Cargo version
15+
- name: Bump version in Cargo.toml
4116
run: |
42-
# python .github/actions/bump_version/cargo_version_bumper.py --target Cargo.toml "${{ github.ref_name }}"
43-
python .github/actions/bump_version/cargo_version_bumper.py --target Cargo.toml "0.2.3"
17+
python .github/actions/bump_version/bump_version.py --target Cargo.toml "${{ github.ref_name }}"
4418
shell: bash
4519

46-
# - name: Check Cargo.toml version matches Release tag
47-
# run: |
48-
# CARGO_VERSION=$(grep '^version =' Cargo.toml | sed 's/.*"\(.*\)".*/\1/')
49-
# if [ "${GITHUB_REF#refs/tags/}" != "$CARGO_VERSION" ]; then
50-
# echo "Version mismatch: Cargo.toml ($CARGO_VERSION) doesn't match Release tag (${GITHUB_REF#refs/tags/})"
51-
# exit 1
52-
# fi
20+
- name: Check version in Cargo.toml matches Release tag
21+
run: |
22+
VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[0].version')
23+
if [ "${GITHUB_REF#refs/tags/}" != "$VERSION" ]; then
24+
echo "Version mismatch: Cargo.toml ($VERSION) doesn't match Release tag (${GITHUB_REF#refs/tags/})"
25+
exit 1
26+
fi
27+
shell: bash
File renamed without changes.

.github/workflows/build_wheels.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,16 @@ jobs:
4141
sudo apt update
4242
sudo apt install pkg-config gcc-aarch64-linux-gnu g++-aarch64-linux-gnu -qy
4343
44-
- name: Bump Cargo version
45-
if: ${{ inputs.auto_bump }}
46-
uses: ./.github/actions/bump_version
47-
4844
- uses: dtolnay/rust-toolchain@master
4945
with:
5046
toolchain: stable
5147
target: ${{ matrix.platform.target}}-unknown-linux-gnu
5248
- uses: Swatinem/rust-cache@v2
5349

50+
- name: Bump version in Cargo.toml
51+
if: ${{ inputs.auto_bump }}
52+
uses: ./.github/actions/bump_version
53+
5454
- name: Build wheels
5555
uses: PyO3/maturin-action@v1
5656
with:
@@ -105,16 +105,16 @@ jobs:
105105
run: |
106106
choco install nasm
107107
108-
- name: Bump Cargo version
109-
if: ${{ inputs.auto_bump }}
110-
uses: ./.github/actions/bump_version
111-
112108
- uses: dtolnay/rust-toolchain@master
113109
with:
114110
toolchain: stable
115111
target: ${{ matrix.platform.alias-target}}
116112
- uses: Swatinem/rust-cache@v2
117113

114+
- name: Bump version in Cargo.toml
115+
if: ${{ inputs.auto_bump }}
116+
uses: ./.github/actions/bump_version
117+
118118
- name: Build wheels
119119
uses: PyO3/maturin-action@v1
120120
with:
@@ -172,16 +172,16 @@ jobs:
172172
- name: Set macOS version
173173
run: echo "MACOSX_DEPLOYMENT_TARGET=${{ matrix.platform.macos_version }}" >> $GITHUB_ENV
174174

175-
- name: Bump Cargo version
176-
if: ${{ inputs.auto_bump }}
177-
uses: ./.github/actions/bump_version
178-
179175
- uses: dtolnay/rust-toolchain@master
180176
with:
181177
toolchain: stable
182178
target: ${{ matrix.platform.target}}-apple-darwin
183179
- uses: Swatinem/rust-cache@v2
184180

181+
- name: Bump version in Cargo.toml
182+
if: ${{ inputs.auto_bump }}
183+
uses: ./.github/actions/bump_version
184+
185185
- name: Build wheels
186186
uses: PyO3/maturin-action@v1
187187
with:

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ __pycache__
88
.idea
99
.pytest_cache
1010
.venv
11-
*_version.py
1211
*.egg-info
1312
*.gguf
1413
*.pyd

0 commit comments

Comments
 (0)