Commit b63350a 1 parent d659cf3 commit b63350a Copy full SHA for b63350a
File tree 1 file changed +41
-0
lines changed
.github/actions/version-tag
1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change
1
+ # You can find code and docs here: https://github.com/allthings/github-action-tools
2
+ name : version-tag
3
+ description : ' Creates a git version tag'
4
+ inputs :
5
+ trigger-workflow-name :
6
+ description : ' Name of workflow that is triggered after creating tag'
7
+ required : false
8
+
9
+ runs :
10
+ using : " composite"
11
+ steps :
12
+ - name : Set PATH
13
+ shell : bash
14
+ run : |
15
+ echo "/bin" >> $GITHUB_PATH
16
+ echo "/sbin" >> $GITHUB_PATH
17
+ echo "/usr/bin" >> $GITHUB_PATH
18
+ echo "/usr/sbin" >> $GITHUB_PATH
19
+ echo "/usr/local/bin" >> $GITHUB_PATH
20
+ echo "/usr/local/sbin" >> $GITHUB_PATH
21
+
22
+ - name : create new tag
23
+ shell : bash
24
+ env :
25
+ WORKFLOW_NAME : ${{ inputs.trigger-workflow-name }}
26
+ run : |
27
+ set +e
28
+ git config user.name "Bot"
29
+ git config user.email "admin@allthings.me"
30
+ currentVersion="$(git describe --tags `git rev-list --tags --max-count=1`)"
31
+ if [ "$currentVersion" = "" ]; then
32
+ currentVersion="v0.0.0"
33
+ fi
34
+ latestVersion="${currentVersion//v[0-9]*.[0-9]*./}"
35
+ ((++latestVersion))
36
+ newVersion="${currentVersion%.*}.$latestVersion"
37
+ git tag -a $newVersion -m "Release new version: $newVersion"
38
+ git push origin $newVersion
39
+ if [ ! -z "${{ env.WORKFLOW_NAME }}" ]; then
40
+ gh workflow run ${{ env.WORKFLOW_NAME }} --ref $newVersion
41
+ fi
You can’t perform that action at this time.
0 commit comments