forked from flowtricks/stacki
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease.sh
More file actions
executable file
·39 lines (31 loc) · 991 Bytes
/
Copy pathrelease.sh
File metadata and controls
executable file
·39 lines (31 loc) · 991 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
#!/bin/bash
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
cd "$SCRIPT_DIR"
# Get current version from package.json
current=$(grep '"version"' package.json | head -1 | sed 's/.*: "\(.*\)".*/\1/')
echo "Current version: $current"
# Split into parts
IFS='.' read -r major minor patch <<< "$current"
# Ask what kind of bump
echo "What kind of release?"
echo " 1) patch ($major.$minor.$((patch + 1)))"
echo " 2) minor ($major.$((minor + 1)).0)"
echo " 3) major ($((major + 1)).0.0)"
read -p "Choose [1/2/3]: " choice
case $choice in
1) new="$major.$minor.$((patch + 1))" ;;
2) new="$major.$((minor + 1)).0" ;;
3) new="$((major + 1)).0.0" ;;
*) echo "Invalid choice"; exit 1 ;;
esac
# Update package.json and package-lock.json together
npm version "$new" --no-git-tag-version
echo "Bumped to $new"
# Commit, tag, and push
git add -A
git commit -m "v$new"
git tag "v$new"
git push
git push --tags
echo "Release v$new triggered!"
open "https://github.com/flowtricks/stacki/actions"