-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathrelease
More file actions
executable file
·56 lines (42 loc) · 995 Bytes
/
release
File metadata and controls
executable file
·56 lines (42 loc) · 995 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
# This script does the following:
# - create a new tag for input vX.X.X
# - rerelease the tag vX.X (so that @shopify/theme-check-action@vX.X) points to the new code
# - update the vX branch to point to the new code
set -eou pipefail
if ! [[ $1 =~ ^v([0-9]+\.){2}[0-9]+$ ]]; then
echo "Version must match vX.X.X"
exit 1
fi
remote="origin"
run() {
echo "$@"
"$@"
}
release() {
run git tag $1
run git push $remote $1
}
deleteTag() {
run git push --delete $remote $1 || true
run git tag --delete $1 || true
}
updateBranch() {
run git fetch $remote $1 || true
local current_branch=$(git rev-parse --abbrev-ref HEAD)
run git checkout $1 || run git checkout -b $1 2> /dev/null
run git reset --hard $remote/$1 || true 2> /dev/null
run git merge $current_branch
run git push $remote $1
run git checkout $current_branch
}
# v1.x.x
tag=$1
release $tag
# v1.x
minor=${tag%.*}
deleteTag $minor
release $minor
# v1
major=${minor%.*}
updateBranch $major