6
6
# - checkout this branch locally
7
7
# - run this script from repo registry-scanner module: ./hack/create-release.sh [TARGET_VERSION] [REMOTE]
8
8
# - merge the PR
9
+ # Example Uses:
10
+ # ./hack/create-release.sh 0.1.1 Would create a new tag "registry-scanner/v0.1.1" with
11
+ # the message "Release registry-scanner/v0.1.1" and edit
12
+ # VERSION file to be 0.1.1 which would be committed.
13
+ #
14
+ # ./hack/create-release.sh 0.1.X upstream Would create a new tag "registry-scanner/v0.1.X" with
15
+ # the message "Relase registry-scanner/v0.1.X" and edit
16
+ # VERSION to be 0.1.X which would be committed. The contents
17
+ # would be pushed to the remote "upstream."
9
18
10
19
TARGET_VERSION=" $1 "
20
+
21
+ USAGE_ERR=" USAGE: $0 [TARGET_VERSION] [REMOTE]"
22
+
11
23
set -eu
12
24
set -o pipefail
13
25
26
+ # Validate if arguments are present
14
27
if test " ${TARGET_VERSION} " = " " ; then
15
- echo " USAGE: $0 <version> <remote> " >&2
28
+ printf " !! TARGET_VERSION is missing\n $USAGE_ERR \n " >&2
16
29
exit 1
17
30
fi
18
-
31
+
19
32
CURRENT_BRANCH=" $( git branch --show-current) "
20
33
SUBMODULE_NAME=" registry-scanner"
21
34
@@ -35,6 +48,7 @@ if [[ ! $(git ls-remote --exit-code ${REMOTE_URL} ${RELEASE_BRANCH}) ]]; then
35
48
fi
36
49
37
50
NEW_TAG=" ${SUBMODULE_NAME} /v${TARGET_VERSION} "
51
+ MESSAGE=" Release ${NEW_TAG} "
38
52
39
53
# ## look for latest on-branch tag to check if it matches the NEW_TAG
40
54
PREVIOUS_TAG=$( git describe --tags --abbrev=0 --match " ${SUBMODULE_NAME} /*" 2> /dev/null || true)
47
61
echo " Creating tag ${NEW_TAG} "
48
62
echo " ${TARGET_VERSION} " > VERSION
49
63
50
- # Create tag for registry-scanner
51
- git tag " ${NEW_TAG} "
52
- git push " ${REMOTE} " tag " ${NEW_TAG} "
64
+ # Commit updated VERSION file
65
+ git add VERSION
66
+ git commit -s -m " ${MESSAGE} "
53
67
68
+ # Create tag for registry-scanner
69
+ git tag -a " ${NEW_TAG} " -m " ${MESSAGE} "
70
+ git push " ${REMOTE} " " ${RELEASE_BRANCH} " " ${NEW_TAG} "
0 commit comments