Skip to content

Commit d50aa0d

Browse files
committed
ci: enforce tag == umbrella version on tag push
1 parent 5a0756c commit d50aa0d

2 files changed

Lines changed: 34 additions & 3 deletions

File tree

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: tag-version-check
2+
3+
# Enforces the release invariant: a version tag X.Y.Z must sit on a commit whose
4+
# umbrella webtrit_callkeep/pubspec.yaml version is X.Y.Z (see docs/release_process.md).
5+
6+
on:
7+
push:
8+
tags:
9+
- "*.*.*"
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
verify:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Verify umbrella version matches the tag
21+
run: |
22+
TAG="${GITHUB_REF_NAME}"
23+
VERSION_FIELD=$(grep -m1 '^version:' webtrit_callkeep/pubspec.yaml | awk '{print $2}')
24+
VERSION="${VERSION_FIELD%%+*}"
25+
echo "tag=$TAG pubspec version=$VERSION_FIELD (base $VERSION)"
26+
if [ "$VERSION" != "$TAG" ]; then
27+
echo "::error::Tag '$TAG' does not match webtrit_callkeep version '$VERSION_FIELD'. The tag must sit on the version-bump commit (see docs/release_process.md)."
28+
exit 1
29+
fi
30+
echo "OK: tag matches the umbrella version."

docs/release_process.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,10 @@ where that version is already set. Tags are **immutable** - never move a publish
3939
4040
## Enforcement
4141

42-
A CI check validates the invariant on tag push: it reads `webtrit_callkeep/pubspec.yaml` at the
43-
tagged commit and fails if the `X.Y.Z` part of `version:` does not equal the tag name. This makes
44-
every published tag a reliable, immutable pointer to its exact release.
42+
A CI check (`.github/workflows/tag-version-check.yaml`) validates the invariant on tag push: it
43+
reads `webtrit_callkeep/pubspec.yaml` at the tagged commit and fails if the `X.Y.Z` part of
44+
`version:` does not equal the tag name. This makes every published tag a reliable, immutable
45+
pointer to its exact release.
4546

4647
## Tag corrections
4748

0 commit comments

Comments
 (0)