-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.mise.toml
More file actions
147 lines (118 loc) · 3.4 KB
/
.mise.toml
File metadata and controls
147 lines (118 loc) · 3.4 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
[tasks.release]
description = "Create and push a new release (usage: mise run release [version])"
run = '''
#!/bin/bash
set -e
# Get version argument or auto-bump
NEW_VERSION="$1"
if [ -z "$NEW_VERSION" ]; then
# Get last tag version
LAST_TAG=$(git tag -l --sort=-v:refname | head -1)
if [ -z "$LAST_TAG" ]; then
echo "Error: No existing tags found. Please specify a version."
echo "Usage: mise run release <version>"
exit 1
fi
# Strip 'v' prefix if present
LAST_VERSION="${LAST_TAG#v}"
# Parse version and bump patch
if [[ $LAST_VERSION =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
MAJOR="${BASH_REMATCH[1]}"
MINOR="${BASH_REMATCH[2]}"
PATCH="${BASH_REMATCH[3]}"
NEW_PATCH=$((PATCH + 1))
NEW_VERSION="$MAJOR.$MINOR.$NEW_PATCH"
echo "Auto-bumping from $LAST_VERSION to $NEW_VERSION"
else
echo "Error: Could not parse last version: $LAST_VERSION"
exit 1
fi
else
# Strip 'v' prefix if user provided it
NEW_VERSION="${NEW_VERSION#v}"
# Validate version format
if ! [[ $NEW_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Error: Version must be in format X.Y.Z (e.g., 0.0.3)"
exit 1
fi
fi
TAG="v$NEW_VERSION"
# Check if tag already exists
if git rev-parse "$TAG" >/dev/null 2>&1; then
echo "Error: Tag $TAG already exists"
exit 1
fi
echo ""
echo "Preparing release $TAG"
echo ""
# Update VERSION in git-wt script
echo "Updating VERSION in git-wt script..."
sed -i.bak "s/^VERSION=.*/VERSION=\"$NEW_VERSION\"/" git-wt
rm -f git-wt.bak
# Show the change
echo "Updated VERSION to $NEW_VERSION"
echo ""
# Commit the version change
echo "Committing version bump..."
git add git-wt
git commit -m "Bump version to $NEW_VERSION"
# Push the commit
echo "Pushing version bump commit..."
git push origin HEAD
# Get last tag for changelog
LAST_TAG=$(git tag -l --sort=-v:refname | head -1)
if [ -z "$LAST_TAG" ]; then
echo "Error: No previous release found for changelog"
exit 1
fi
echo "Creating release notes from $LAST_TAG to $TAG..."
echo ""
# Create git tag
git tag -a "$TAG" -m "Release version $NEW_VERSION"
echo "Created tag $TAG"
# Push tag
echo "Pushing tag to remote..."
git push origin "$TAG"
# Create GitHub release
echo ""
echo "Creating GitHub release..."
gh release create "$TAG" \
--title "$TAG" \
--notes "## What's Changed
$(git log $LAST_TAG..HEAD --pretty=format:'* %s' --no-merges)
**Full Changelog**: https://github.com/deanputney/git-wt/compare/$LAST_TAG...$TAG"
echo ""
echo "✓ Release $TAG created successfully!"
echo ""
echo "Release URL: https://github.com/deanputney/git-wt/releases/tag/$TAG"
'''
[tasks."release:dry-run"]
description = "Preview what the next release would be without creating it"
run = '''
#!/bin/bash
set -e
# Get last tag version
LAST_TAG=$(git tag -l --sort=-v:refname | head -1)
if [ -z "$LAST_TAG" ]; then
echo "No existing tags found."
exit 1
fi
# Strip 'v' prefix if present
LAST_VERSION="${LAST_TAG#v}"
# Parse version and bump patch
if [[ $LAST_VERSION =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
MAJOR="${BASH_REMATCH[1]}"
MINOR="${BASH_REMATCH[2]}"
PATCH="${BASH_REMATCH[3]}"
NEW_PATCH=$((PATCH + 1))
NEW_VERSION="$MAJOR.$MINOR.$NEW_PATCH"
echo "Current version: $LAST_VERSION"
echo "Next version: $NEW_VERSION"
echo ""
echo "Changes since $LAST_TAG:"
git log $LAST_TAG..HEAD --pretty=format:'* %s' --no-merges
else
echo "Error: Could not parse last version: $LAST_VERSION"
exit 1
fi
'''