-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.sh
executable file
·32 lines (30 loc) · 1.02 KB
/
build.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
#!/bin/bash
git remote set-url origin https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
BRANCHNAME=${GITHUB_REF#refs/heads/}
if [ "${BRANCHNAME}" = "master" ]; then
# If branch is master, version up normally.
ELS_VER=`git describe --tags --abbrev=0`
while [[ ${ELS_VER} == *-* ]]; do
git tag -d ${ELS_VER}
git push origin :${ELS_VER}
ELS_VER=`git describe --tags --abbrev=0`
done
ELS_NVER="${ELS_VER%.*}.`expr ${ELS_VER##*.} + 1`"
else
# If branch is not master(pull req), use same version
ELS_VER=`git describe --tags --abbrev=0`
if [[ ${ELS_VER} == *-* ]]; then
# If the version is already used, delete that.
git tag -d ${ELS_VER}
git push origin :${ELS_VER}
fi
# Set version
ELS_VER=`git describe --tags --abbrev=0`
ELS_NVER="${ELS_VER%.*}.`expr ${ELS_VER##*.} + 1`-${BRANCHNAME}"
fi
echo "${ELS_VER} -> ${ELS_NVER}"
# Set version tag
git tag ${ELS_NVER}
git push --tags
# Release binary
GO111MODULE=off go run release.go ${GITHUB_REPOSITORY} ${BRANCHNAME} ${ELS_NVER}