File tree Expand file tree Collapse file tree 1 file changed +32
-18
lines changed Expand file tree Collapse file tree 1 file changed +32
-18
lines changed Original file line number Diff line number Diff line change 55USER=" tomnomnom"
66REPO=" gron"
77BINARY=" ${REPO} "
8- ARCHIVE=" ${BINARY} -linux-amd64-${TAG} .tgz"
98
109if [[ -z " ${TAG} " ]]; then
1110 echo " Usage: ${0} <tag>"
@@ -18,20 +17,35 @@ if [[ -z "${GITHUB_TOKEN}" ]]; then
1817fi
1918
2019cd ${PROJDIR}
21- go build github.com/${USER} /${REPO}
22- tar --create --gzip --file=${ARCHIVE} ${BINARY}
23-
24- github-release release \
25- --user ${USER} \
26- --repo ${REPO} \
27- --tag ${TAG} \
28- --name " ${REPO} v${TAG} " \
29- --description " v${TAG} " \
30- --pre-release
31-
32- github-release upload \
33- --user ${USER} \
34- --repo ${REPO} \
35- --tag ${TAG} \
36- --name " ${ARCHIVE} " \
37- --file ${PROJDIR} /${ARCHIVE}
20+
21+ # Check if tag exists
22+ git fetch --tags
23+ git tag | grep " ^${TAG} $"
24+
25+ if [ $? -ne 0 ]; then
26+ github-release release \
27+ --user ${USER} \
28+ --repo ${REPO} \
29+ --tag ${TAG} \
30+ --name " ${REPO} v${TAG} " \
31+ --description " v${TAG} " \
32+ --pre-release
33+ fi
34+
35+
36+ for OS in " darwin" " linux" ; do
37+
38+ rm -f ${BINARY}
39+
40+ GOOS=${OS} GOARCH=amd64 go build github.com/${USER} /${REPO}
41+
42+ ARCHIVE=" ${BINARY} -${OS} -amd64-${TAG} .tgz"
43+ tar --create --gzip --file=${ARCHIVE} ${BINARY}
44+
45+ github-release upload \
46+ --user ${USER} \
47+ --repo ${REPO} \
48+ --tag ${TAG} \
49+ --name " ${ARCHIVE} " \
50+ --file ${PROJDIR} /${ARCHIVE}
51+ done
You can’t perform that action at this time.
0 commit comments