Skip to content

Commit f08648e

Browse files
committed
NEW Create action
1 parent 74f5614 commit f08648e

File tree

3 files changed

+8
-31
lines changed

3 files changed

+8
-31
lines changed

.github/workflows/auto-tag.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
name: Auto-tag
12
on:
23
push:
34
tags:
@@ -8,7 +9,4 @@ jobs:
89
runs-on: ubuntu-latest
910
steps:
1011
- 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

README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Using the 'v' prefix to avoid confusion with the '2' branch naming convention th
1414

1515
## Usage
1616

17-
.github/workflows/auto-tag.yml
17+
**.github/workflows/auto-tag.yml**
1818
```yml
1919
on:
2020
push:
@@ -27,8 +27,4 @@ jobs:
2727
steps:
2828
- name: Auto-tag
2929
uses: silverstripe/gha-auto-tag@main
30-
with:
31-
ref: ${{ github.ref }}
32-
sha: ${{ github.sha }}
33-
3430
```

action.yml

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,28 @@
11
name: Auto-tag
22
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
123

134
runs:
145
using: composite
156
steps:
16-
- name: Validate inputs
7+
- name: Validate ref
178
shell: bash
189
env:
19-
REF: ${{ inputs.ref }}
20-
SHA: ${{ inputs.sha }}
10+
REF: ${{ github.ref }}
2111
run: |
2212
# refs/tags/0.1.23 => 0.1.23
2313
TAG=$(echo $REF | cut -c 11-)
2414
if [[ "$TAG" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
25-
echo "Valid tag $TAG"
15+
echo "Valid semver tag $TAG"
2616
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"
17+
echo "Invalid semver tag $TAG"
3418
exit 1
3519
fi
3620
3721
- name: Generate tag name
3822
id: generate_tag_name
3923
shell: bash
4024
env:
41-
REF: ${{ inputs.ref }}
25+
REF: ${{ github.ref }}
4226
run: |
4327
# refs/tags/0.1.23 => 0.1.23
4428
TAG=$(echo $REF | cut -c 11-)
@@ -56,7 +40,6 @@ runs:
5640
- name: Add tag to repo
5741
uses: silverstripe/gha-tag-release@main
5842
with:
59-
sha: ${{ github.sha }}
6043
tag: ${{ steps.generate_tag_name.outputs.tag }}
6144
delete_existing: true
6245
release: false

0 commit comments

Comments
 (0)