forked from miso-lims/miso-lims
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpromote_release.sh
More file actions
executable file
·51 lines (43 loc) · 1.55 KB
/
promote_release.sh
File metadata and controls
executable file
·51 lines (43 loc) · 1.55 KB
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
#!/bin/bash
set -euo pipefail
MAIN_BRANCH="develop"
# validate prerequisites
if [[ ! $(command -v gh) ]]; then
echo "Error: GitHub CLI not found"
exit 1
fi
# validate git state
if [[ ! $(git branch | grep \* | cut -d ' ' -f2) = "${MAIN_BRANCH}" ]]; then
echo "Error: Not on ${MAIN_BRANCH} branch" >&2
exit 2
fi
git fetch
if (( $(git log HEAD..origin/${MAIN_BRANCH} --oneline | wc -l) > 0 )); then
echo "Error: Branch is not up-to-date with remote origin" >&2
exit 3
fi
MISO_VERSION_OLD=$(git describe --tags --abbrev=0); export MISO_VERSION_OLD=${MISO_VERSION_OLD:1}
# Post official release to GitHub
git fetch --tags
git checkout tags/v${MISO_VERSION_OLD}
mvn clean package
pushd miso-web/src/main/resources
SETUP_FILES="setup_files.tar.gz"
tar -czf "../../../../${SETUP_FILES}" *.properties
popd
ANCHOR=$(grep "^## \[${MISO_VERSION_OLD}\]" RELEASE_NOTES.md | sed -e 's/ - /---/; s/[# \.\[]//g; s/\]//g')
gh release create v${MISO_VERSION_OLD} \
--notes "[Release Notes](https://github.com/miso-lims/miso-lims/blob/develop/RELEASE_NOTES.md#${ANCHOR})" \
miso-web/target/ROOT.war \
sqlstore/target/sqlstore-*.jar \
${SETUP_FILES}
rm ${SETUP_FILES}
echo "GitHub release v${MISO_VERSION_OLD} posted"
# Update master branch
git checkout master
git reset origin/master --hard
git rebase --onto v${MISO_VERSION_OLD} master
git push origin master
echo "Master branch updated"
echo "v${MISO_VERSION_OLD} promoted to latest official release. Copy this export into your shell before doing the Docker build:"
echo "export MISO_VERSION_OLD=${MISO_VERSION_OLD}"