Skip to content

Commit ad803df

Browse files
🐛 Fix git tag creation in release workflow, revert v1 release (#95)
Co-authored-by: ChristophShyper <45788587+ChristophShyper@users.noreply.github.com>
1 parent 6aa1acb commit ad803df

4 files changed

Lines changed: 24 additions & 21 deletions

File tree

.github/workflows/release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ jobs:
2929
version: 3.x
3030

3131
- name: Create and push git tags
32+
env:
33+
VERSION: ${{ github.event.inputs.version }}
3234
run: |
3335
git config user.name "github-actions[bot]"
3436
git config user.email "github-actions[bot]@users.noreply.github.com"

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
```yaml
3535
- name: Run the Action
36-
uses: devops-infra/template-action@v1
36+
uses: devops-infra/template-action@v0
3737
env:
3838
barfoo: foobaz
3939
with:
@@ -79,7 +79,7 @@ jobs:
7979
runs-on: ubuntu-latest
8080
steps:
8181
- uses: actions/checkout@v5
82-
- uses: devops-infra/template-action@v1
82+
- uses: devops-infra/template-action@v0
8383
```
8484
8585
### 🔀 Advanced
@@ -93,7 +93,7 @@ jobs:
9393
runs-on: ubuntu-latest
9494
steps:
9595
- uses: actions/checkout@v5
96-
- uses: devops-infra/template-action@v1
96+
- uses: devops-infra/template-action@v0
9797
with:
9898
foobar: hello
9999
debug: 'true'
@@ -111,13 +111,13 @@ jobs:
111111
steps:
112112
- uses: actions/checkout@v5
113113

114-
- uses: devops-infra/template-action@v1.0.0
114+
- uses: devops-infra/template-action@v0.2.0
115115
id: Pin patch version
116116

117-
- uses: devops-infra/template-action@v1.0
117+
- uses: devops-infra/template-action@v0.2
118118
id: Pin minor version
119119

120-
- uses: devops-infra/template-action@v1
120+
- uses: devops-infra/template-action@v0
121121
id: Pin major version
122122
```
123123

Taskfile.scripts.yml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,25 @@ tasks:
2727
2828
echo "ℹ️ INFO: Tags - Full: $FULL | Minor: $MINOR | Major: $MAJOR"
2929
30-
# Full tag: create and push only if absent on remote
30+
# Full tag: must NOT exist on remote; fail fast if it does
3131
full_remote_sha="$(remote_tag_sha "$FULL")"
32-
if [ -z "$full_remote_sha" ]; then
33-
if git rev-parse -q --verify "refs/tags/$FULL" >/dev/null 2>&1; then
34-
echo "ℹ️ INFO: Full tag '$FULL' exists locally but not on remote; pushing"
35-
else
36-
echo "ℹ️ INFO: Creating full tag '$FULL'"
37-
git tag -a "$FULL" -m "$FULL"
38-
fi
39-
git push "$REMOTE" "refs/tags/$FULL"
40-
echo "✅ OK: Pushed full tag '$FULL'"
32+
if [ -n "$full_remote_sha" ]; then
33+
echo "❌ ERROR: Full tag '$FULL' already exists on remote; aborting" >&2
34+
exit 1
35+
fi
36+
37+
# Create full tag locally (if missing) and push
38+
if git rev-parse --quiet --verify "refs/tags/$FULL" >/dev/null 2>&1; then
39+
echo "ℹ️ INFO: Full tag '$FULL' exists locally but not on remote; pushing"
4140
else
42-
echo "ℹ️ INFO: Full tag '$FULL' already exists on remote; skipping"
41+
echo "ℹ️ INFO: Creating full tag '$FULL'"
42+
git tag --annotate "$FULL" --message "$FULL"
4343
fi
44+
git push "$REMOTE" "refs/tags/$FULL"
45+
echo "✅ OK: Pushed full tag '$FULL'"
4446
4547
# Minor tag: create or update
46-
git tag -f -a "$MINOR" -m "$FULL"
48+
git tag --force --annotate "$MINOR" --message "$FULL"
4749
minor_local_sha="$(tag_sha "$MINOR")"
4850
minor_remote_sha="$(remote_tag_sha "$MINOR")"
4951
if [ -z "$minor_remote_sha" ]; then
@@ -59,7 +61,7 @@ tasks:
5961
fi
6062
6163
# Major tag: create or update
62-
git tag -f -a "$MAJOR" -m "$FULL"
64+
git tag --force --annotate "$MAJOR" --message "$FULL"
6365
major_local_sha="$(tag_sha "$MAJOR")"
6466
major_remote_sha="$(remote_tag_sha "$MAJOR")"
6567
if [ -z "$major_remote_sha" ]; then

Taskfile.variables.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ vars:
7878
VERSION_FULL: v{{.MAJOR}}.{{.MINOR}}.{{.PATCH}}
7979

8080
# Git metadata
81-
DEFAULT_BRANCH:
82-
sh: git symbolic-ref refs/remotes/origin/HEAD | {{.SED}} 's@^refs/remotes/origin/@@'
81+
DEFAULT_BRANCH: master
8382
GIT_SHA:
8483
sh: git rev-parse HEAD 2>/dev/null || echo 0000000000000000000000000000000000000000
8584
GIT_SHORT_SHA:

0 commit comments

Comments
 (0)