-
Notifications
You must be signed in to change notification settings - Fork 11
/
release.sh
executable file
·52 lines (40 loc) · 1.31 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
#!/bin/bash
# ensure $VERSION is set
if [ -z "$VERSION" ] ; then
echo "Error: environment variable VERSION must be set"
exit 1
fi
# ensure no uncommited change
if ! git diff --quiet HEAD -- ; then
echo "Error: all changes needs to be committed to git"
exit 1
fi
# check if a release by this tag already exists
git fetch --tags
if [ $(git tag -l "$VERSION") ]; then
echo "Error: tag $VERSION already exists. Please use another one."
exit 1
fi
set -x #echo on
# update Version in Dockerrun.aws.json and docker-compose.yml
sed -i -r 's/website:[^"]+/website:'"$VERSION"'/g' Dockerrun.aws.json
sed -i -r 's/website:[^"]+/website:'"$VERSION"'/g' docker-compose.yml
# release commit
git diff
git add Dockerrun.aws.json
git add docker-compose.yml
git commit -m "release $VERSION"
git tag "$VERSION"
git push origin "$VERSION"
# build container
make build
# tag container
docker tag wormbase/website:latest 357210185381.dkr.ecr.us-east-1.amazonaws.com/wormbase/website:$VERSION
# push containers to AWS ECR
docker push 357210185381.dkr.ecr.us-east-1.amazonaws.com/wormbase/website:$VERSION
# # post-release clean up
# sed -i -r 's/website:[^"]+/website:'"latest"'/g' Dockerrun.aws.json
# git add Dockerrun.aws.json
# git commit -m "post-release cleanup"
set -x #echo off
echo "Successfully created release $VERSION"