Skip to content

Commit 6341207

Browse files
Joe MonaghanJoe Monaghan
authored andcommitted
add versioning script.
1 parent 0552b53 commit 6341207

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ FROM alpine:3.11.3
1515
RUN apk --no-cache add ca-certificates \
1616
&& addgroup exporter \
1717
&& adduser -S -G exporter exporter
18+
ADD VERSION .
1819
USER exporter
1920
COPY --from=build /bin/main /bin/main
2021
ENV LISTEN_PORT=9171

VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.0.0

release-version.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
3+
# ensure git is in the correct branch and has latest from remote.
4+
git checkout master
5+
git pull origin master
6+
7+
version=$(cat VERSION.txt)
8+
echo "version: $version"
9+
10+
# exist if tag alredy exists.
11+
if [ $(git tag -l "$version") ]; then
12+
echo "tag already exists. Ensure verion number has been update in VERSION."
13+
exit 1
14+
fi
15+
16+
# check version is in the correct format.
17+
if ! [[ "$version" =~ ^[0-9.]+$ ]]; then
18+
echo "version: "$version" is in the wrong format."
19+
exit 1
20+
fi
21+
22+
# tag current latest commit.
23+
echo "tagging..."
24+
git tag $version
25+
26+
# push tag to trigger build.
27+
echo "pushing tag to trigger build..."
28+
git push origin $version

0 commit comments

Comments
 (0)