Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,6 @@ log:
sync_readme:
cp README.md npm/README.md

[doc('Release: bump versions, commit, and tag (just tag [patch|minor|major])')]
[doc('Release: bump versions, commit, and tag from main (just tag [patch|minor|major])')]
tag bump="":
sh scripts/tag_and_release.sh {{ bump }}
20 changes: 17 additions & 3 deletions scripts/tag_and_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,21 @@ if [ -n "$(git status --porcelain)" ]; then
exit 1
fi

branch="$(git branch --show-current)"
if [[ "$branch" != "main" ]]; then
echo "❗ Releases must be tagged from main (currently on '${branch:-detached HEAD}')."
echo " git checkout main && git pull && just tag"
exit 1
fi

echo "🦋 Fetching origin/main..."
git fetch --quiet origin main

if ! git merge-base --is-ancestor origin/main HEAD; then
echo "❗ local main has diverged from origin/main. Pull/rebase first."
exit 1
fi

# Written by AI :)
NAME=$(sed -n 's/^name *= *"\([^"]*\)".*/\1/p' Cargo.toml)
CURRENT=$(sed -n 's/^version *= *"\([^"]*\)".*/\1/p' Cargo.toml)
Expand Down Expand Up @@ -74,9 +89,8 @@ echo "🦋 Creating git tag v${NEW}"
git tag "v${NEW}"

# Create release binaries (with cargo-dist)
echo "🦋 Pushing..."
git push
git push --tags
echo "🦋 Pushing release commit and tag atomically..."
git push --atomic origin main "v${NEW}"

# ============================================
# PUBLISHING: I put it here as documentation, but this is manual for now!
Expand Down
Loading