-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease.sh
More file actions
executable file
·44 lines (34 loc) · 1.26 KB
/
release.sh
File metadata and controls
executable file
·44 lines (34 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env bash
set -euo pipefail
# Check if we have uncommitted changes
STATUS_OUTPUT=$(jj status)
if ! echo "$STATUS_OUTPUT" | grep -q "The working copy has no changes."; then
echo "Error: Working copy has uncommitted changes. Please commit or stash them first."
exit 1
fi
# Get the current version from git-cliff
echo "Generating changelog..."
git-cliff --bump -o CHANGELOG.md
# Check if CHANGELOG.md was actually modified
STATUS_OUTPUT=$(jj status)
if echo "$STATUS_OUTPUT" | grep -q "CHANGELOG.md"; then
# Stage and commit the changelog
echo "Committing changelog..."
jj commit -m "chore: Update changelog"
# Get the version from the changelog (extract from the first ## line)
VERSION=$(grep -m 1 "^## \[" CHANGELOG.md | sed 's/^## \[\(.*\)\] - .*/\1/')
if [ -z "$VERSION" ]; then
echo "Error: Could not extract version from changelog"
exit 1
fi
echo "Creating tag v$VERSION..."
git tag "v$VERSION"
echo "Setting main bookmark to current revision..."
jj bookmark set main -r @-
echo "Pushing main and tag to GitHub..."
jj git push --bookmark main
git push --tags
echo "Release v$VERSION completed successfully!"
else
echo "No changes to changelog detected. Release not needed."
fi