This repository was archived by the owner on Oct 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrelease.sh
More file actions
executable file
·70 lines (54 loc) · 1.64 KB
/
release.sh
File metadata and controls
executable file
·70 lines (54 loc) · 1.64 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash -e
#
# Usage:
# ./release.sh v1.0.0 "Comment for release"
TAG="$1"
if [ "$TAG" == "" ]
then
echo "ERROR: You must specify a tag parameter, e.g. v1.0.0" >&2
exit 1
fi
COMMENT="$2"
if [ "$COMMENT" == "" ]
then
echo "ERROR: You must specify a comment parameter" >&2
exit 1
fi
if [ "$GITHUB_TOKEN" == "" ]
then
echo "ERROR: You must set GITHUB_TOKEN to make a release" >&2
exit 1
fi
CURRENT_BRANCH=$(git branch | grep "^\*" | awk '{print $2;}')
if [ "$CURRENT_BRANCH" != "master" ]
then
echo "ERROR: You must be on the master branch locally" >&2
exit 1
fi
# check clone has same commit point as upstream master
git fetch upstream master || exit 2
CLONE_MASTER_COMMIT=$(git show-ref refs/heads/master | awk '{print $1;}')
UPSTREAM_MASTER_COMMIT=$(git ls-remote upstream master | awk '{print $1;}')
if [ "$CLONE_MASTER_COMMIT" != "$UPSTREAM_MASTER_COMMIT" ]
then
echo "ERROR: Your clone master must be at the same commit point as upstream master" >&2
exit 1
fi
# go generate || exit 2
(cd ui && npm build) || exit 2
echo "Logging in to dockerhub"
docker login || exit 2
# echo "Ensuring latest go version"
# docker pull golang:latest
echo "Building goethite/gostint:$TAG image"
docker build -t goethite/gostint:$TAG . || exit 2
echo "Pushing goethite/gostint:$TAG to dockerhub"
docker push goethite/gostint:$TAG || exit 2
docker tag goethite/gostint:$TAG goethite/gostint:latest || exit 2
docker push goethite/gostint:latest || exit 2
echo "Tagging master as $TAG"
git tag -a $TAG -m "$COMMENT" || exit 2
echo "Pushing tag $TAG upstream"
git push upstream $TAG || exit 2
echo "Releasing to github..."
goreleaser --rm-dist || exit 2