generated from pboymt/userscript-typescript-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease.sh
executable file
·49 lines (42 loc) · 1.42 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
#!/bin/bash
set -o errexit
set -o nounset
traperr() {
echo "ERROR: ${BASH_SOURCE[1]} at about ${BASH_LINENO[0]}"
}
set -o errtrace
trap traperr ERR
ACTION=${1:?ACTION argument is required}
BRANCH_VERSION=${2:?BRANCH_VERSION argument is required}
echo "Make sure we can run via docker_node by asking for the node version..."
./docker_node node --version
echo "Make sure the repo is up-to-date..."
git fetch
case "$ACTION" in
createBranch)
echo "Creating release branch for ${BRANCH_VERSION}.x series..."
git checkout -b release/${BRANCH_VERSION} origin/main
echo "Setting version to ${BRANCH_VERSION}.0..."
./docker_node npm --no-git-tag-version version ${BRANCH_VERSION}.0
;;
createPatch)
# This might be implicit
git checkout release/${BRANCH_VERSION}
echo "Incrementing PATCH portion of ${BRANCH_VERSION}..."
./docker_node npm --no-git-tag-version version patch
;;
*)
echo "Unrecognized action '${ACTION}'."
exit 1
;;
esac
echo "Performing release..."
CURRENT_VERSION=$(./docker_node node -pe "require('./package.json').version" | tr -d '[:space:]')
./docker_node npm install
./docker_node npm run setUrls "release/${BRANCH_VERSION}"
git add package-lock.json package.json
./docker_node npm test
./docker_node npm run build
git add userscript/index.user.js -f
git commit -m "release ${CURRENT_VERSION}"
git tag v${CURRENT_VERSION}