Skip to content

Commit 30fa469

Browse files
committed
fix(ci): inject CARGO_PKG_VERSION_PRE via gitversion-rs --updatepackagefiles in build job
# ── git-warden policy guide ── # Write the commit message in English # AI co-author trailers will be removed before commit
1 parent ea2a593 commit 30fa469

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

.github/workflows/release-draft.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,38 @@ jobs:
8484
- uses: actions/checkout@v4
8585
with:
8686
ref: refs/tags/${{ needs.release.outputs.tag }}
87+
fetch-depth: 0
88+
89+
- name: Install gitversion-rs
90+
env:
91+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
92+
shell: bash
93+
run: |
94+
GV_TAG=$(gh release view --repo zcube/gitversion-rs --json tagName -q .tagName)
95+
case "${{ runner.os }}" in
96+
Linux)
97+
gh release download "$GV_TAG" --repo zcube/gitversion-rs \
98+
--pattern "gitversion-rs-${GV_TAG}-x86_64-unknown-linux-musl.tar.gz" --dir /tmp/gv
99+
tar xzf /tmp/gv/gitversion-rs-${GV_TAG}-x86_64-unknown-linux-musl.tar.gz -C /tmp/gv
100+
sudo install -m 0755 /tmp/gv/gitversion-rs /usr/local/bin/gitversion-rs
101+
;;
102+
macOS)
103+
gh release download "$GV_TAG" --repo zcube/gitversion-rs \
104+
--pattern "gitversion-rs-${GV_TAG}-${{ matrix.target }}.tar.gz" --dir /tmp/gv
105+
tar xzf /tmp/gv/gitversion-rs-${GV_TAG}-${{ matrix.target }}.tar.gz -C /tmp/gv
106+
sudo install -m 0755 /tmp/gv/gitversion-rs /usr/local/bin/gitversion-rs
107+
;;
108+
Windows)
109+
gh release download "$GV_TAG" --repo zcube/gitversion-rs \
110+
--pattern "gitversion-rs-${GV_TAG}-x86_64-pc-windows-msvc.zip" --dir /tmp/gv
111+
unzip /tmp/gv/gitversion-rs-${GV_TAG}-x86_64-pc-windows-msvc.zip -d /tmp/gv
112+
cp /tmp/gv/gitversion-rs.exe /usr/local/bin/gitversion-rs.exe
113+
;;
114+
esac
115+
gitversion-rs --version
116+
117+
- name: Set version via gitversion-rs
118+
run: gitversion-rs --updatepackagefiles
87119

88120
- name: Install Rust toolchain
89121
uses: dtolnay/rust-toolchain@stable

0 commit comments

Comments
 (0)