File tree Expand file tree Collapse file tree 3 files changed +10
-42
lines changed Expand file tree Collapse file tree 3 files changed +10
-42
lines changed Original file line number Diff line number Diff line change
1
+ name : Auto-tag
1
2
on :
2
3
push :
3
4
tags :
8
9
runs-on : ubuntu-latest
9
10
steps :
10
11
- name : Auto-tag
11
- uses : emteknetnz/gha-auto-tag@main
12
- with :
13
- ref : ${{ github.ref }}
14
- sha : ${{ github.sha }}
12
+ uses : silverstripe/gha-auto-tag@main
Original file line number Diff line number Diff line change @@ -14,7 +14,9 @@ Using the 'v' prefix to avoid confusion with the '2' branch naming convention th
14
14
15
15
## Usage
16
16
17
- .github/workflows/auto-tag.yml
17
+ This action has no configuration or inputs - just add the following workflow verbatim.
18
+
19
+ ** .github/workflows/auto-tag.yml**
18
20
``` yml
19
21
on :
20
22
push :
27
29
steps :
28
30
- name : Auto-tag
29
31
uses : silverstripe/gha-auto-tag@main
30
- with :
31
- ref : ${{ github.ref }}
32
- sha : ${{ github.sha }}
33
-
34
32
` ` `
Original file line number Diff line number Diff line change 1
1
name : Auto-tag
2
2
description : Automatically delete and re-release tags so that other github action modules can use something similar to carets e.g. v0.1 or v3
3
- inputs :
4
- ref :
5
- type : string
6
- required : true
7
- description : github.ref when workflow is triggered by x.y.z semver tag e.g. refs/tags/0.1.23
8
- sha :
9
- type : string
10
- required : true
11
- description : SHA of the tag
12
3
13
4
runs :
14
5
using : composite
15
6
steps :
16
- - name : Validate inputs
17
- shell : bash
18
- env :
19
- REF : ${{ inputs.ref }}
20
- SHA : ${{ inputs.sha }}
21
- run : |
22
- # refs/tags/0.1.23 => 0.1.23
23
- TAG=$(echo $REF | cut -c 11-)
24
- if [[ "$TAG" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
25
- echo "Valid tag $TAG"
26
- else
27
- echo "Invalid tag $TAG"
28
- exit 1
29
- fi
30
- if [[ "$SHA" =~ ^[0-9a-f]{40}$ ]]; then
31
- echo "Valid sha $SHA"
32
- else
33
- echo "Invalid sha $SHA"
34
- exit 1
35
- fi
36
-
37
7
- name : Generate tag name
38
8
id : generate_tag_name
39
9
shell : bash
40
10
env :
41
- REF : ${{ inputs .ref }}
11
+ REF : ${{ github .ref }}
42
12
run : |
43
13
# refs/tags/0.1.23 => 0.1.23
44
14
TAG=$(echo $REF | cut -c 11-)
45
- [[ $TAG =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]
15
+ if ! [[ $TAG =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
16
+ echo "Invalid semver tag $TAG"
17
+ exit 1
18
+ fi
46
19
MAJOR="${BASH_REMATCH[1]}"
47
20
MINOR="${BASH_REMATCH[2]}"
48
21
PATCH="${BASH_REMATCH[3]}"
56
29
- name : Add tag to repo
57
30
uses : silverstripe/gha-tag-release@main
58
31
with :
59
- sha : ${{ github.sha }}
60
32
tag : ${{ steps.generate_tag_name.outputs.tag }}
61
33
delete_existing : true
62
34
release : false
You can’t perform that action at this time.
0 commit comments