generated from BCDevOps/opendev-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tag.sh
executable file
·44 lines (30 loc) · 840 Bytes
/
tag.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
#!/bin/bash -l
usage() {
echo "usage: tag.sh <tag_name>"
exit 1
}
exitWithMessage() {
echo $1
if [ $# -eq 2 ]
then
exit $2
else
exit 1
fi
}
if [[ `git status --porcelain` ]]; then
exitWithMessage "There are local changes. Please revert or commit these before running this command."
fi
if [ $# -eq 0 ]
then
usage
else
export TAG=$1
fi
read -p "About to update action file to use new Docker tag '${TAG}'. Press any key to continue..."
yq -i ".runs.image = \"docker://ghcr.io/bcgov/devhub-techdocs-publish:$TAG\"" action.yml
read -p "About to commit new action file and create new git tag '${TAG}'. Press any key to continue..."
git commit -a -m "Updated action.yml to use a new Docker image with tag '${TAG}'."
#git push
git tag -a -m "adding version tag $TAG" $TAG
git push --follow-tags