-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
72 lines (58 loc) · 1.61 KB
/
release.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/sh
set -e
ok() { printf " [\e[0;32m ok \e[0m] $1\n"; }
ko() { printf "[\e[0;31m error \e[0m] $1\n"; }
nf() { printf " [\e[1;34m info \e[0m] $1\n"; }
usage() { ko "Usage: $0 [-v <version number>]" 1>&2; exit 1; }
if [[ ! $1 =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then
usage
fi
catch() {
local parent_lineno="$1"
local message="$2"
local code="${3:-1}"
if [[ -n "$message" ]] ; then
ko "Error on or near line ${parent_lineno}: ${message}; exiting with status ${code}"
else
ko "Error on or near line ${parent_lineno}; exiting with status ${code}"
fi
exit "${code}"
}
trap 'catch ${LINENO}' ERR
v=$1
nf "Pull from origin/develop..."
git checkout develop
git pull origin
ok "Pull complete"
nf "Create new branch 'release/${v}'..."
git checkout -b release/$v
nf "Update package version..."
npm version $v --no-git-tag-version
git add package.json package-lock.json
git commit -m "Bump version ${v}"
nf "Build Userscript..."
npm run build:userscript
ok "Userscript successfully built"
nf "Build Chrome extension..."
npm run build:extension
ok "Extension successfully built"
nf "Commit build..."
git add dist/*.*
git commit -m "Build ${v}"
nf "Merge into master..."
git checkout master
git pull origin
git merge --no-ff release/${v}
git branch -d release/${v}
ok "Merge complete"
nf "Push to origin..."
git push origin
ok "Push complete"
nf "Create version tag..."
git tag $v
git push origin $v
ok "Release complete!"
nf "Don't forget to:"
nf " - publish to the Chrome Web Store"
nf " \e[4mhttps://chrome.google.com/webstore/developer/edit/ifbjebjodkkageignlfdkipikmdllhjf\e[0m"
nf " - rebase develop --onto master"