-
Notifications
You must be signed in to change notification settings - Fork 5
/
bump.sh
executable file
·56 lines (43 loc) · 1.18 KB
/
bump.sh
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
#!/bin/bash
# Enable errors
set -e
# Check whether there is a version argument
if [ -z "$1" ]; then
printf "ERR: No version identifier supplied!\n"
exit 1
else
echo "-- Bumping version $1"
# Fetching tags to make sure unknown tags are not re-created
echo "-- Fetching tags and releases from remote"
git fetch --all --tags
# shellcheck disable=SC2046
if [ $(git tag -l "v$1") ]; then
echo "ERR: Git tag v$1 already exists!"
exit 1
fi
echo "-- Building files"
pnpm run build
# Run the version command for the root package
echo "-- Updating root project"
pnpm version "$1"
# Revert the auto-generated commit
echo "-- Removed auto-generated commit from pnpm version"
git reset --soft HEAD~1
# Delete the auto generated tag
echo "-- Remove generated tag from pnpm version"
git tag -d "v$1"
# Run the version command for every package
echo "-- Updating child projects"
pnpm -r version "$1"
# Commit changes
echo "-- Committing changes"
git commit -a -m "Release $1"
git tag -a "v$1" -m "Release $1"
# Update lock files
echo "-- Updating lock files"
pnpm install
# Push tags
git push origin "v$1"
# Exit
exit 0
fi