This repository has been archived by the owner on Nov 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathrelease-tag.sh
executable file
·97 lines (79 loc) · 3.23 KB
/
release-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
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/usr/bin/env bash
set -o errexit # Abort script at first error (command exits non-zero).
root="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
reset=$(tput sgr0)
red=$(tput setaf 1)
green=$(tput setaf 2)
yellow=$(tput setaf 3)
: "${PUSH:=false}"
if [[ -z $1 ]] ; then
>&2 echo "Missing argument!"
echo "Usage:"
echo " release-tag.sh <version> [<push>]"
echo ""
echo "Example:"
echo " release-tag.sh 0.9.3"
echo " release-tag.sh 0.9.3 push"
exit 1
else
TAG="$1"
if [[ $2 = push ]] ; then
PUSH="true"
fi
fi
echo "${green}
██╗ ██╗ █████╗ ███╗ ███╗██████╗ ████████╗ █████╗ ██████╗ ██████╗ ███████╗██████╗
██║ ██║██╔══██╗████╗ ████║██╔══██╗ ╚══██╔══╝██╔══██╗██╔════╝ ██╔════╝ ██╔════╝██╔══██╗
██║ ██║███████║██╔████╔██║██████╔╝ ██║ ███████║██║ ███╗██║ ███╗█████╗ ██████╔╝
╚██╗ ██╔╝██╔══██║██║╚██╔╝██║██╔═══╝ ██║ ██╔══██║██║ ██║██║ ██║██╔══╝ ██╔══██╗
╚████╔╝ ██║ ██║██║ ╚═╝ ██║██║ ██║ ██║ ██║╚██████╔╝╚██████╔╝███████╗██║ ██║
╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝
by magnetic.io
${reset}"
# Ensure we're tagging vamp-docker-images as well
if [[ "$( git tag --list $TAG )" = "$TAG" ]] ; then
if [[ "$( git tag | tail -n1 )" != "$TAG" ]] ; then
echo "${yellow}Warning:${reset} Tag ${TAG} already exists but you're on a different commit:"
git show --no-patch
echo
>&2 echo "${red}Error: Exiting!${reset}"
exit 1
fi
else
git tag "$TAG"
if [[ "$PUSH" = "true" ]] ; then
git push --tags
fi
fi
workspace=${root}/target
mkdir -p ${workspace}
tag() {
project=$1
url="[email protected]:magneticio/${project}.git"
echo "${green}project: ${yellow}${project}${reset}"
cd ${workspace}
if [[ -d ${workspace}/${project} ]] ; then
echo "${green}updating existing repository${reset}"
cd ${workspace}/${project}
git reset --hard
git checkout master
git pull
else
git clone --depth=200 "$url"
cd ${workspace}/${project}
fi
if [[ "$( git tag | tail -n1 )" != "$TAG" ]] ; then
git tag "$TAG" || { echo "${yellow}${project}: tag exists, ${TAG}, continuing${reset}"; git checkout "$TAG"; }
fi
if [[ "$PUSH" = "true" ]] ; then
git push --tags
fi
}
tag vamp
tag vamp-ee
tag vamp-ui
tag vamp-ee-ui
tag vamp-artifacts
tag vamp-runner
tag vamp-gateway-agent
tag vamp-workflow-agent