Skip to content

Commit 491be80

Browse files
authored
fix: let gh skills publish own tag creation in create-release workflow (#281)
1 parent 2a4f949 commit 491be80

2 files changed

Lines changed: 13 additions & 13 deletions

File tree

.github/workflows/create-release.lock.yml

Lines changed: 1 addition & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/create-release.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,28 +65,31 @@ safe-outputs:
6565
VERSION=$(jq -r 'first(.items[] | select(.type == "create_release")) | .version' "$GH_AW_AGENT_OUTPUT")
6666
git config user.name "github-actions[bot]"
6767
git config user.email "github-actions[bot]@users.noreply.github.com"
68-
git fetch --tags
69-
git tag "v${VERSION}"
70-
git push origin "v${VERSION}"
7168
gh skills publish --tag "v${VERSION}"
7269
---
7370

7471
## Task
7572

7673
This is a **${{ github.event.inputs.bump }}** release. The build has already passed. Your job is to determine the next version and create the release.
7774

78-
### Step 1 — Determine the next version
75+
### Step 1 — Determine the latest published version
76+
77+
Run both commands and use whichever returns a higher version:
7978

8079
```bash
8180
git fetch --tags
82-
PREVIOUS_TAG=$(git tag -l 'v[0-9]*.[0-9]*.[0-9]*' | sort -V | tail -n 1)
83-
if [ -z "$PREVIOUS_TAG" ]; then PREVIOUS_TAG="v0.0.0"; fi
84-
echo "$PREVIOUS_TAG"
81+
git tag -l 'v[0-9]*.[0-9]*.[0-9]*' | sort -V | tail -n 1
8582
```
8683

84+
```bash
85+
gh release list --json tagName --jq '[.[].tagName | select(test("^v[0-9]+\\.[0-9]+\\.[0-9]+$"))] | sort | last // empty'
86+
```
87+
88+
Take the greater of the two values as `PREVIOUS_TAG`. If both are empty, use `v0.0.0`.
89+
8790
### Step 2 — Compute the next version
8891

89-
Note the previous tag printed above. Then compute the next semver version by applying a **${{ github.event.inputs.bump }}** bump:
92+
Note the previous tag determined above. Then compute the next semver version by applying a **${{ github.event.inputs.bump }}** bump:
9093
- `patch`: increment the patch number (e.g. `v1.2.3``1.2.4`)
9194
- `minor`: increment the minor number, reset patch (e.g. `v1.2.3``1.3.0`)
9295
- `major`: increment the major number, reset minor and patch (e.g. `v1.2.3``2.0.0`)
@@ -97,4 +100,4 @@ Call the `create_release` tool with:
97100

98101
- `version`: the computed next version string (without the `v` prefix, e.g. `1.2.4`)
99102

100-
Call `noop` only if the computed tag already exists locally (`git rev-parse "v<next-version>"`) or on origin (`git ls-remote --tags origin "v<next-version>"`).
103+
Call `noop` only if the computed release already exists: check both `git ls-remote --tags origin "v<next-version>"` and `gh release view "v<next-version>"`. If either indicates the version exists, call `noop` instead.

0 commit comments

Comments
 (0)