File tree Expand file tree Collapse file tree 1 file changed +29
-11
lines changed
Expand file tree Collapse file tree 1 file changed +29
-11
lines changed Original file line number Diff line number Diff line change @@ -3,31 +3,49 @@ name: Create Tag
33on :
44 workflow_dispatch :
55 inputs :
6- branch :
7- description : ' Branch or ref to create tag from'
8- required : true
9- type : string
6+ action :
7+ description : ' push or delete'
8+ required : false
9+ type : choice
10+ default : push
11+ options :
12+ - push
13+ - delete
1014 tag :
11- description : ' Tag name to create (e.g. v1.0.0) '
15+ description : ' Tag name'
1216 required : true
1317 type : string
18+ message :
19+ description : ' Tag message (used when action is push)'
20+ required : false
21+ type : string
22+ default : ' '
1423
1524jobs :
16- create- tag :
17- name : Create and push tag
25+ tag-job :
26+ name : Tag ${{ inputs.action }}
1827 runs-on : ubuntu-latest
1928 permissions :
2029 contents : write
2130 steps :
22- - name : Checkout repository
31+ - name : Checkout
2332 uses : actions/checkout@v4
2433 with :
25- ref : ${{ inputs.branch }}
34+ ref : main
2635 fetch-depth : 0
2736
28- - name : Create and push tag
37+ - name : Push tag
38+ if : inputs.action == 'push'
2939 run : |
3040 git config user.name "github-actions[bot]"
3141 git config user.email "github-actions[bot]@users.noreply.github.com"
32- git tag "${{ inputs.tag }}"
42+ if [ -n "${{ inputs.message }}" ]; then
43+ git tag -a "${{ inputs.tag }}" -m "${{ inputs.message }}"
44+ else
45+ git tag "${{ inputs.tag }}"
46+ fi
3347 git push origin "${{ inputs.tag }}"
48+
49+ - name : Delete tag
50+ if : inputs.action == 'delete'
51+ run : git push origin --delete "${{ inputs.tag }}"
You can’t perform that action at this time.
0 commit comments