-
Notifications
You must be signed in to change notification settings - Fork 64
Expand file tree
/
Copy pathrelease
More file actions
executable file
·42 lines (31 loc) · 903 Bytes
/
release
File metadata and controls
executable file
·42 lines (31 loc) · 903 Bytes
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
#!/usr/bin/env bash
set -euo pipefail
VERSION="${1:-}"
if [ -z "$VERSION" ]; then
echo "Usage: ./release <version>"
echo "Example: ./release v8.3.1"
exit 1
fi
echo "Checking current branch..."
CURRENT_BRANCH="$(git rev-parse --abbrev-ref HEAD)"
if [ "$CURRENT_BRANCH" != "master" ]; then
echo "Error: You must be on 'master' branch. Current branch: $CURRENT_BRANCH"
exit 1
fi
echo "Checking working directory is clean..."
if [ -n "$(git status --porcelain)" ]; then
echo "Error: Working directory is not clean. Commit or stash changes first."
exit 1
fi
echo "Fetching latest changes..."
git fetch
echo "Tagging version $VERSION..."
git tag "$VERSION"
echo "Updating 'latest' tag..."
git tag -f latest
echo "Pushing master..."
git push origin master
echo "Pushing tags..."
git push origin "$VERSION"
git push origin latest --force
echo "Release $VERSION completed successfully!"