Skip to content

Commit 163218d

Browse files
committed
chore: update release workflow version handling
1 parent 6f38deb commit 163218d

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

.github/workflows/release.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ jobs:
3939
- name: Checkout code
4040
uses: actions/checkout@v4
4141

42+
- name: Extract version from tag and update Cargo.toml
43+
shell: bash
44+
run: |
45+
VERSION=${GITHUB_REF#refs/tags/v}
46+
sed -i.bak "s/^version = \".*\"/version = \"${VERSION}\"/" Cargo.toml
47+
rm Cargo.toml.bak
48+
4249
- name: Install Rust toolchain
4350
uses: dtolnay/rust-toolchain@master
4451
with:
@@ -97,6 +104,7 @@ jobs:
97104
uses: actions/checkout@v4
98105
with:
99106
fetch-depth: 0
107+
token: ${{ secrets.GITHUB_TOKEN }}
100108

101109
- name: Download all artifacts
102110
uses: actions/download-artifact@v4
@@ -184,3 +192,32 @@ jobs:
184192
checksums.txt
185193
draft: false
186194
prerelease: false
195+
196+
- name: Checkout main branch
197+
run: |
198+
git config --global user.name "sshdb-release-bot"
199+
git config --global user.email "[email protected]"
200+
git checkout main || git checkout master
201+
202+
- name: Update Cargo.toml with release version
203+
run: |
204+
VERSION="${{ steps.tag.outputs.VERSION }}"
205+
sed -i.bak "s/^version = \".*\"/version = \"${VERSION}\"/" Cargo.toml
206+
rm Cargo.toml.bak
207+
git add Cargo.toml
208+
git commit -m "chore: update version to ${VERSION} for release" || echo "No changes to commit"
209+
210+
- name: Bump Cargo.toml to dev version
211+
run: |
212+
VERSION="${{ steps.tag.outputs.VERSION }}"
213+
sed -i.bak "s/^version = \".*\"/version = \"${VERSION}-dev\"/" Cargo.toml
214+
rm Cargo.toml.bak
215+
git add Cargo.toml
216+
git commit -m "chore: bump version to ${VERSION}-dev" || echo "No changes to commit"
217+
218+
- name: Push version updates
219+
env:
220+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
221+
run: |
222+
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}
223+
git push origin main || git push origin master

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "sshdb"
3-
version = "0.16.1"
3+
version = "0.16-dev"
44
edition = "2021"
55
description = "Keyboard-first SSH library and launcher TUI."
66
authors = ["Riccardo Iaconelli <[email protected]>"]

0 commit comments

Comments
 (0)