-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·51 lines (35 loc) · 998 Bytes
/
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
#!/usr/bin/env bash
set -euo pipefail
source scripts/common.source
readonly VERSION=$(get_candidate_version "$@")
readonly RELEASE_BRANCH=release-${VERSION}
readonly MODIFIED_FILES=$(git ls-files -m)
if [[ "${MODIFIED_FILES}" != "" ]] ; then
echo "ERROR: Following files are in a modified status, commit them or stash them."
echo "${MODIFIED_FILES}"
exit 1
fi
git checkout ${BRANCH} -b ${RELEASE_BRANCH}
cleanup() {
git checkout ${BRANCH}
git tag -d ${VERSION} || true
git branch -D ${RELEASE_BRANCH} || true
}
trap cleanup EXIT
./build.sh
sed -i -e "s/$(cat version.txt)/${VERSION}/g" README.md
echo "${VERSION}" > version.txt
git add README.md version.txt
git commit -m "New version ${VERSION}"
git tag -a ${VERSION} -m "Version ${VERSION}"
git checkout ${VERSION}
git push origin ${VERSION}
./scripts/tag.sh
./scripts/push.sh
git checkout latest
git pull
git merge ${RELEASE_BRANCH}
git push origin latest
git checkout ${BRANCH}
git merge latest
git push origin ${BRANCH}