File tree 1 file changed +47
-0
lines changed
1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ set -e
4
+
5
+ # setup git config
6
+ git config user.name " github_action_bot"
7
+ git config user.email " no_email_address"
8
+
9
+ # puts the static string replace where the second . is
10
+ # example
11
+ # v1.1.0 -> v1.1replace0
12
+ current_tag=$( git tag | tail -1 | sed ' s/\./replace/2' )
13
+ echo " current_tag - ${current_tag} "
14
+ echo " current_minor_version - ${current_tag##* replace} "
15
+
16
+ # takes everything after the string 'replace' and adds 1
17
+ # v1.1replace0 -> 1
18
+ new_minor_version=$(( ${current_tag##* replace} + 1 ))
19
+ echo " new_minor_version - ${new_minor_version} "
20
+
21
+ # takes everything before the string 'replace'
22
+ # v1.1replace0 -> v1.1
23
+ tag_without_minor_version=" ${current_tag% replace* } ."
24
+ echo " tag_without_minor_version - ${tag_without_minor_version} "
25
+
26
+ # concatenates new tag
27
+ new_tag=${tag_without_minor_version}${new_minor_version}
28
+ echo " new_tag - ${new_tag} "
29
+
30
+
31
+ tag_message=" prevent_disable - ${tag_without_minor_version}${new_minor_version} "
32
+ echo " tag_message - ${tag_message} "
33
+
34
+
35
+ # only add a tag on the 1st day of the month
36
+ if [ $( date +%d) = " 01" ]; then
37
+
38
+ git tag $new_tag -m " $tag_message "
39
+ echo " added unnecessary tag"
40
+
41
+ git push origin $new_tag
42
+ echo " tag addition complete"
43
+
44
+ fi
45
+
46
+
47
+ git tag
You can’t perform that action at this time.
0 commit comments