Skip to content

Commit 948910a

Browse files
committed
No more '-alpha' in release tags.
1 parent 0564115 commit 948910a

3 files changed

Lines changed: 21 additions & 28 deletions

File tree

.github/workflows/release_main.yaml

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,15 @@ name: Release on push to main
88
# bot needs write access to a protected branch.
99
#
1010
# - First release ever (no v* tag yet): seed from package.json. With
11-
# package.json at 0.1.1-alpha.0 this publishes v0.1.1-alpha.
11+
# package.json at 0.1.3 this publishes v0.1.3.
1212
# - Every release after that: bump the latest tag. Default is a patch bump
13-
# (v0.1.1-alpha -> v0.1.2-alpha). The development -> main merge commit can
14-
# opt into a larger bump via trigger words:
15-
# "BREAKING CHANGE" / "type!:" / "[major]" -> major (v0.1.1-alpha -> v1.0.0-alpha)
16-
# "feat:" / "feat(scope):" / "[minor]" -> minor (v0.1.1-alpha -> v0.2.0-alpha)
17-
# anything else (default) -> patch (v0.1.1-alpha -> v0.1.2-alpha)
13+
# (v0.1.3 -> v0.1.4). The development -> main merge commit can opt into a
14+
# larger bump via trigger words:
15+
# "BREAKING CHANGE" / "type!:" / "[major]" -> major (v0.1.3 -> v1.0.0)
16+
# "feat:" / "feat(scope):" / "[minor]" -> minor (v0.1.3 -> v0.2.0)
17+
# anything else (default) -> patch (v0.1.3 -> v0.1.4)
1818
#
19-
# npm keeps a numeric prerelease iterator internally (e.g. -alpha.0); it is
20-
# stripped for the tag/release name only (v0.1.2-alpha.0 -> v0.1.2-alpha).
19+
# Tags are plain semver (vMAJOR.MINOR.PATCH) — no prerelease suffix.
2120
#
2221
# package.json's version is no longer the source of truth after the first
2322
# release — the release tags are. It is kept only to seed that first release.
@@ -93,41 +92,35 @@ jobs:
9392
LATEST_TAG="$(git tag -l 'v*' --sort=-v:refname | head -n1)"
9493
9594
if [ -z "$LATEST_TAG" ]; then
96-
# First release: seed from package.json. The version is carried as-is
97-
# here; the iterator strip below turns 0.1.1-alpha.0 into the
98-
# v0.1.1-alpha tag.
95+
# First release: seed from package.json, carried as-is.
9996
NEXT="$(node -p "require('./package.json').version")"
10097
echo "No prior release tag — seeding first release from package.json: ${NEXT}"
10198
else
10299
# Derive the next version by bumping the latest tag with npm's semver engine.
100+
# Bumping a prerelease tag with a plain level drops the suffix rather than
101+
# incrementing (npm/semver behaviour), so the first release after retiring
102+
# the -alpha line promotes v0.1.3-alpha -> v0.1.3; subsequent bumps are
103+
# ordinary semver increments.
103104
BASE="${LATEST_TAG#v}"
104105
TMP="$(mktemp -d)"
105106
printf '{"name":"x","version":"%s"}\n' "$BASE" > "$TMP/package.json"
106-
( cd "$TMP" && npm version "pre${LEVEL}" --preid=alpha --no-git-tag-version >/dev/null )
107+
( cd "$TMP" && npm version "${LEVEL}" --no-git-tag-version >/dev/null )
107108
NEXT="$(node -p "require('${TMP}/package.json').version")"
108109
rm -rf "$TMP"
109110
echo "Latest release ${LATEST_TAG} -> next version ${NEXT}"
110111
fi
111112
112-
# Strip the numeric prerelease iterator for the tag only (-alpha.0 -> -alpha).
113-
TAG_VERSION="$NEXT"
114-
if [[ "$NEXT" =~ -[0-9A-Za-z-]+[.][0-9]+$ ]]; then
115-
TAG_VERSION="${NEXT%.*}"
116-
fi
117-
TAG="v${TAG_VERSION}"
113+
TAG="v${NEXT}"
118114
119115
if gh release view "$TAG" >/dev/null 2>&1; then
120116
echo "Release $TAG already exists — nothing to do."
121117
exit 0
122118
fi
123119
124-
# Publish as the repo's "Latest" release rather than a GitHub
125-
# pre-release. While in early access every promotion is an -alpha, and
126-
# "Latest" is the signal consumers actually follow — so the newest
127-
# promotion must own it. The overall pre-release/early-access state is
128-
# carried by the separate `early-access` tag/release, not by flagging
129-
# each version as a GitHub pre-release. --latest is explicit so the new
130-
# release always takes the badge from the prior one.
120+
# Publish as the repo's "Latest" release. Every promotion to main is a
121+
# production release, so it must own the "Latest" badge that consumers
122+
# follow. --latest is explicit so the new release always takes the badge
123+
# from the prior one.
131124
gh release create "$TAG" \
132125
--target "$GITHUB_SHA" \
133126
--title "$TAG" \

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tpen3-services",
3-
"version": "0.1.1-alpha.0",
3+
"version": "0.1.3",
44
"description": "TPEN3 Services for data interaction.",
55
"type": "module",
66
"keywords": [

0 commit comments

Comments
 (0)