blob: b0a390cb49866fd31f5535d1f6c82a38cca46409 (
plain)
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
|
#!/usr/bin/env bash
# fail on unset variables and command errors
set -eu -o pipefail # -x: is for debugging
function print_info() {
echo -e "\e[36mINFO: ${1}\e[m"
}
if [ "$(git branch --show-current)" != "master" ]; then
echo "$0: Current branch is not master" 1>&2
exit 1
fi
RELEASE_TYPE_LIST="prerelease prepatch patch preminor minor major premajor"
if command -v fzf; then
RELEASE_TYPE=$(echo "${RELEASE_TYPE_LIST}" | tr ' ' '\n' | fzf --layout=reverse)
else
select sel in ${RELEASE_TYPE_LIST}; do
RELEASE_TYPE="${sel}"
break
done
fi
echo -e "$0: Create \e[36m${RELEASE_TYPE}\e[m release, continue? (y/n)"
read -r res
if [ "${res}" = "n" ]; then
echo "$0: Stop script"
exit 0
fi
git fetch origin
git pull origin master
git pull origin --tags
npm ci
npm run build
RESOURCES_DIR="resources"
cp -r "./exampleSite/${RESOURCES_DIR}" .
if [ -n "$(git diff ${RESOURCES_DIR})" ]; then
git add "${RESOURCES_DIR}"
git commit -m "chore(release): update ${RESOURCES_DIR}"
else
print_info "skip add and commit for ${RESOURCES_DIR}"
fi
npm run release -- --release-as "${RELEASE_TYPE}" --preset eslint
TAG_NAME="v$(jq -r '.version' ./package.json)"
git push origin master
git push origin "${TAG_NAME}"
|