Skip to content

Commit 41e9433

Browse files
chore(ci): assert tags are bare version numbers (no v prefix) (#19)
ShellSyntaxTree convention: release tags are SemVer version numbers verbatim — no decoration. Example: `0.1.0-alpha`, NOT `v0.1.0-alpha`. The tag value IS the package version. publish_nuget.yml changes: - Trigger broadened to `tags: ['*']` so the workflow fires on ANY tag push; mistakes show up in CI rather than silently no-op-ing. - New first step "Assert tag is a bare version number": * fails fast with a clear ::error:: message if the tag starts with 'v' * fails if the tag isn't SemVer-shaped (`<major>.<minor>.<patch>[-prerelease]`) * on success, writes PACKAGE_VERSION=<tag> straight to GITHUB_ENV - "Compute package version from tag" step folded into the assert (no more `${TAG#v}` strip; the assert guarantees no leading v). Version-string cleanups in docs: - README.md: Versioning section header now lists `0.1.0-alpha` / `0.1.x` / `0.2.0` / `1.0.0` (no v prefix); added a one-liner explaining the convention. - IMPLEMENTATION_PLAN.md: NOW / NEXT / LATER bucket headings switched from `v0.1.x` to `0.1.x` etc.; the example tag-push command is now `git tag 0.1.0-alpha && git push origin 0.1.0-alpha`. Tests / build clean. Public API surface unchanged. This lands before the first tag push so the workflow's assertion is in place when 0.1.0-alpha goes out.
1 parent b0fc239 commit 41e9433

3 files changed

Lines changed: 36 additions & 22 deletions

File tree

.github/workflows/publish_nuget.yml

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ name: Publish NuGet
22

33
on:
44
push:
5+
# Fire on ALL tag pushes so the format guard (below) catches mistakes
6+
# like `v0.1.0-alpha` loudly instead of silently no-op-ing.
57
tags:
6-
- 'v*.*.*'
7-
- 'v*.*.*-*'
8+
- '*'
89

910
permissions:
1011
contents: write
@@ -17,6 +18,24 @@ jobs:
1718
environment: nuget # Must match the environment named in the nuget.org Trusted Publisher policy.
1819

1920
steps:
21+
- name: "Assert tag is a bare version number"
22+
shell: bash
23+
run: |
24+
# ShellSyntaxTree convention: tags are SemVer version numbers WITHOUT
25+
# a leading 'v'. E.g., `0.1.0-alpha`, NOT `v0.1.0-alpha`. The tag is
26+
# the package version verbatim.
27+
TAG="${GITHUB_REF_NAME}"
28+
if [[ "$TAG" == v* ]]; then
29+
echo "::error::Tag '$TAG' starts with 'v'. ShellSyntaxTree tags must be bare SemVer version numbers (e.g., '0.1.0-alpha', not 'v0.1.0-alpha'). Delete this tag and retag without the leading 'v'."
30+
exit 1
31+
fi
32+
if ! [[ "$TAG" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9._-]+)?$ ]]; then
33+
echo "::error::Tag '$TAG' is not a valid SemVer version. Expected '<major>.<minor>.<patch>' or '<major>.<minor>.<patch>-<prerelease>' (e.g., '1.0.0' or '0.2.0-beta.1')."
34+
exit 1
35+
fi
36+
echo "PACKAGE_VERSION=${TAG}" >> "$GITHUB_ENV"
37+
echo "Tag '$TAG' is a valid bare version. Publishing package version: ${TAG}"
38+
2039
- name: "Checkout"
2140
uses: actions/checkout@v6.0.2
2241
with:
@@ -31,15 +50,6 @@ jobs:
3150
- name: "Restore .NET tools"
3251
run: dotnet tool restore
3352

34-
- name: "Compute package version from tag"
35-
shell: bash
36-
run: |
37-
# tag form is vX.Y.Z or vX.Y.Z-suffix
38-
TAG="${GITHUB_REF_NAME}"
39-
VERSION="${TAG#v}"
40-
echo "PACKAGE_VERSION=${VERSION}" >> "$GITHUB_ENV"
41-
echo "Publishing package version: ${VERSION}"
42-
4353
- name: "dotnet pack"
4454
run: dotnet pack /p:PackageVersion=${{ env.PACKAGE_VERSION }} -c Release -o ./output
4555

IMPLEMENTATION_PLAN.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ bulldoze priorities.
99
1010
---
1111

12-
## NOW (v0.1.0-alpha shipping path)
12+
## NOW (0.1.0-alpha shipping path)
1313

1414
> **Active OpenSpec change:** `v0.1-locked-interpretations` — captures
1515
> the eight planning-interview decisions (see
@@ -169,15 +169,16 @@ bulldoze priorities.
169169
- [x] Wired into `pr_validation.yml` via standard `dotnet test`
170170
(no separate job)
171171

172-
### 13. Release v0.1.0-alpha — PR 7 in flight
172+
### 13. Release 0.1.0-alpha — PR 7 in flight
173173

174-
- [x] `RELEASE_NOTES.md` updated with v0.1.0-alpha section
174+
- [x] `RELEASE_NOTES.md` updated with 0.1.0-alpha section
175175
- [x] `dotnet pack -c Release -o ./bin/nuget` produces clean
176176
`ShellSyntaxTree.0.1.0-alpha.nupkg` + `.snupkg` with embedded
177177
README, icon, SourceLink metadata
178178
- [ ] **STOP after PR 7 merges** — await user go-ahead before pushing
179-
`v0.1.0-alpha` tag (the tag → nuget.org publish is irreversible)
180-
- [ ] On user go-ahead: `git tag v0.1.0-alpha && git push origin v0.1.0-alpha`
179+
`0.1.0-alpha` tag (the tag → nuget.org publish is irreversible)
180+
- [ ] On user go-ahead: `git tag 0.1.0-alpha && git push origin 0.1.0-alpha`
181+
(tags are bare SemVer, no `v` prefix — `publish_nuget.yml` asserts this)
181182
- [ ] Verify `publish_nuget.yml` produces release on tag push and the
182183
package appears on nuget.org
183184

@@ -203,7 +204,7 @@ bulldoze priorities.
203204

204205
---
205206

206-
## NEXT (v0.1.x — additive, post-alpha)
207+
## NEXT (0.1.x — additive, post-alpha)
207208

208209
- Seed 50–100 corpus entries from sanitized real-world dogfood logs
209210
(SPEC §14 workflow)
@@ -214,7 +215,7 @@ bulldoze priorities.
214215
- Performance sanity check (~1 ms typical) with a tiny BenchmarkDotNet
215216
harness — only if anything in the daemon hot path complains
216217

217-
## LATER (v0.2+ — out of v0.1 scope)
218+
## LATER (0.2+ — out of 0.1 scope)
218219

219220
- PowerShell parser (`PwshParser : IShellParser`) — first time we exercise
220221
the multi-shell seam

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,14 @@ dotnet pack -c Release -o ./bin/nuget
173173

174174
## Versioning
175175

176-
- **v0.1.0-alpha** — first publishable cut. Bash-only.
177-
- **v0.1.x** — additive (more verb table entries, more corpus, bug
176+
Tags are bare SemVer version numbers — no `v` prefix. The release
177+
workflow asserts this and fails fast on misformatted tags.
178+
179+
- **0.1.0-alpha** — first publishable cut. Bash-only.
180+
- **0.1.x** — additive (more verb table entries, more corpus, bug
178181
fixes).
179-
- **v0.2.0** — first PowerShell parser.
180-
- **v1.0.0** — when an external consumer beyond Netclaw ships against
182+
- **0.2.0** — first PowerShell parser.
183+
- **1.0.0** — when an external consumer beyond Netclaw ships against
181184
it without finding API gaps.
182185

183186
## License

0 commit comments

Comments
 (0)