forked from DependencyTrack/frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·54 lines (49 loc) · 1.52 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
#!/usr/bin/env bash
clear
RELEASE_TYPE=patch
PS3='Select the type of release to perform: '
releaseTypes=("Major" "Minor" "Patch" "Quit")
select opt in "${releaseTypes[@]}"
do
case $opt in
"Major")
RELEASE_TYPE=major
break
;;
"Minor")
RELEASE_TYPE=minor
break
;;
"Patch")
RELEASE_TYPE=patch
break
;;
"Quit")
break
;;
*) echo "invalid option $REPLY";;
esac
done
npm version $RELEASE_TYPE
if [[ "$?" -ne 0 ]] ; then
echo 'Aborting release due to version incremental failure. Ensure there are no modified/uncommitted files in the repo'; exit $rc
fi
npm run build
if [[ "$?" -ne 0 ]] ; then
echo 'Aborting release due to build failure'; exit $rc
fi
PACKAGE_VERSION=$(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g' | tr -d '[[:space:]]')
zip -r frontend-dist.zip dist/*
echo Publishing $PACKAGE_VERSION to GitHub Releases
# pip install githubrelease
# https://github.com/j0057/github-release
githubrelease release dependencytrack/frontend create $PACKAGE_VERSION \
--name $PACKAGE_VERSION --body "Dependency-Track Frontend" \
--publish bom.xml bom.json frontend-dist.zip
REPO=dependencytrack/frontend
docker rmi $REPO:latest
docker rmi $REPO:$PACKAGE_VERSION
docker build --no-cache --pull -f docker/Dockerfile -t $REPO:$PACKAGE_VERSION -t $REPO:latest .
docker login
docker push $REPO:latest
docker push $REPO:$PACKAGE_VERSION