Skip to content

Commit 6137b83

Browse files
fix(release): the dry run has no tag to read
`GITHUB_REF_NAME` is the branch on a manual dispatch, so the version check compared the manifests against "main" and failed — making the rehearsal impossible to rehearse with. On a tag push the tag is the authority and the manifests must match it; on a dispatch the manifests are the authority and what is being tested is everything after that check. The changelog section is verified in the same step, so a missing one fails before publishing rather than producing an empty release body after it.
1 parent 06a7026 commit 6137b83

1 file changed

Lines changed: 23 additions & 6 deletions

File tree

.github/workflows/release.yml

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,26 +42,43 @@ jobs:
4242
id: version
4343
run: |
4444
set -euo pipefail
45-
tag="${GITHUB_REF_NAME#v}"
46-
echo "tag says: $tag"
45+
46+
# On a tag push the tag is the authority and the manifests must match
47+
# it. On a manual dispatch there is no tag — the ref is a branch — so
48+
# the manifests are the authority and what is being rehearsed is
49+
# everything after this check.
50+
if [ "$GITHUB_REF_TYPE" = "tag" ]; then
51+
version="${GITHUB_REF_NAME#v}"
52+
echo "tag says: $version"
53+
else
54+
version=$(node -p "require('./packages/core/package.json').version")
55+
echo "no tag (dispatch); manifests say: $version"
56+
fi
4757
4858
for package in core cli agentfile; do
4959
manifest=$(node -p "require('./packages/$package/package.json').version")
50-
if [ "$manifest" != "$tag" ]; then
51-
echo "::error::packages/$package is $manifest but the tag says $tag"
60+
if [ "$manifest" != "$version" ]; then
61+
echo "::error::packages/$package is $manifest but the release is $version"
5262
exit 1
5363
fi
5464
done
5565
66+
# The changelog is the release notes, so its absence is a failure now
67+
# rather than an empty release body later.
68+
if ! grep -q "^## \\[$version\\]" CHANGELOG.md; then
69+
echo "::error::CHANGELOG.md has no section for $version"
70+
exit 1
71+
fi
72+
5673
# Anything with a hyphen is a pre-release: 2.0.0-beta.1 goes out under
5774
# the `next` dist-tag so `npm install @agentfile/cli` keeps resolving
5875
# to the last stable version.
59-
case "$tag" in
76+
case "$version" in
6077
*-*) prerelease=true ;;
6178
*) prerelease=false ;;
6279
esac
6380
64-
echo "version=$tag" >> "$GITHUB_OUTPUT"
81+
echo "version=$version" >> "$GITHUB_OUTPUT"
6582
echo "prerelease=$prerelease" >> "$GITHUB_OUTPUT"
6683
6784
- run: npm ci

0 commit comments

Comments
 (0)