Skip to content

Commit 257eb4c

Browse files
committed
Update tags.just
1 parent 39b4964 commit 257eb4c

2 files changed

Lines changed: 34 additions & 0 deletions

File tree

.justfiles/tags.just

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,33 @@ push-all:
5050
delete-remote version:
5151
git push origin --delete "{{version}}"
5252
@echo "✅ Deleted tag {{version}} from origin"
53+
54+
# Bump version, tag, and push (patch|minor|major)
55+
[no-cd]
56+
next level="patch":
57+
#!/usr/bin/env bash
58+
set -euo pipefail
59+
suffix="alpha-stable"
60+
level="{{level}}"
61+
62+
latest=$(git tag -l "v*-${suffix}" --sort=-version:refname | head -1)
63+
64+
if [ -z "$latest" ]; then
65+
new="v0.1.0-${suffix}"
66+
else
67+
nums="${latest#v}"
68+
nums="${nums%-${suffix}}"
69+
IFS='.' read -r major minor patch <<< "$nums"
70+
71+
case "$level" in
72+
major) major=$((major + 1)); minor=0; patch=0 ;;
73+
minor) minor=$((minor + 1)); patch=0 ;;
74+
patch) patch=$((patch + 1)) ;;
75+
*) echo "Unknown level: $level (use patch, minor, or major)"; exit 1 ;;
76+
esac
77+
new="v${major}.${minor}.${patch}-${suffix}"
78+
fi
79+
80+
git tag -a "$new" -m "$new"
81+
git push origin "$new"
82+
echo "Released $new"

Justfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ mod release '.justfiles/release.just'
2222
[doc('Git tag management')]
2323
mod tags '.justfiles/tags.just'
2424

25+
# Create next release and push (patch|minor|major)
26+
release-next level="patch":
27+
@just tags next {{level}}
28+
2529
[private]
2630
default:
2731
#!/usr/bin/env bash

0 commit comments

Comments
 (0)