File tree Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Tag Version
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+
8+ jobs :
9+ tag-version :
10+ runs-on : ubuntu-latest
11+ if : " contains(github.event.head_commit.message, ':bookmark:')"
12+
13+ steps :
14+ - uses : actions/checkout@v4
15+ with :
16+ fetch-depth : ' 0'
17+
18+ - name : Tag version
19+ run : |
20+ msg_start=':bookmark: Version '
21+ version_format='[0-9]{1,}\.[0-9]{1,}\.[0-9]{1,}'
22+ version=$(git log -1 --skip=0 --pretty=%s | grep -oP "(?<=${msg_start})${version_format}")
23+
24+ if [ -z "${version}" ]; then
25+ echo 'Version not found, aborting.'
26+ exit 1
27+ fi
28+
29+ echo "Found version: ${version}";
30+ tag="v${version}";
31+
32+ echo "Would tag: ${tag}";
33+ existing_tag=$(git tag -l "${tag}");
34+
35+ if [ "${existing_tag}" ]; then
36+ echo "Tag '${existing_tag}' already exists, aborting.";
37+ exit 1;
38+ fi
39+
40+ git config user.name "Mindee";
41+ git config user.email "opensource@mindee.com"
42+
43+ git tag -a "${tag}" -m"Version ${version}";
44+ git push origin "${tag}"
45+
46+ echo "Tagged and pushed: ${tag}"
You can’t perform that action at this time.
0 commit comments