Skip to content

Commit b63350a

Browse files
itmustbemagicgithub-actions[bot]
authored andcommitted
feat: update action scripts
1 parent d659cf3 commit b63350a

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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

0 commit comments

Comments
 (0)