Skip to content

Commit a55deb9

Browse files
will-lamertonclaude
andcommitted
release: v0.1.0-alpha.3
Fixes the npm dist-tag handling that left `latest` on 0.1.0-alpha.0, so the documented `npx @nanocollective/sentinel init` installed the first alpha instead of the current one. Pre-1.0 every release is a prerelease and publishes under `alpha`, which never claims `latest`. The workflow now moves `latest` onto each new prerelease while no stable version exists; once 0.1.0 ships, `npm publish --tag latest` claims the tag and the step stops firing. The version check also no longer resolves `npm view … version` (the `latest` tag, which was the thing lagging). It reads the full published list instead, so an already-published version cannot be reported as new and the release compare link points at the right previous version. No changes to Sentinel itself. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent b12d5df commit a55deb9

3 files changed

Lines changed: 70 additions & 6 deletions

File tree

.github/workflows/release.yml

Lines changed: 54 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ jobs:
3131
- name: Check version difference
3232
id: version-check
3333
run: |
34-
PACKAGE_VERSION=$(node -p "require('./package.json').version")
34+
# Exported so the inline node scripts below can read it.
35+
export PACKAGE_VERSION=$(node -p "require('./package.json').version")
3536
echo "package-version=$PACKAGE_VERSION" >> $GITHUB_OUTPUT
3637
3738
if [[ "$PACKAGE_VERSION" == *"-beta"* ]]; then
@@ -48,14 +49,34 @@ jobs:
4849
echo "npm-tag=latest" >> $GITHUB_OUTPUT
4950
fi
5051
51-
NPM_VERSION=$(npm view @nanocollective/sentinel version 2>/dev/null || echo "0.0.0")
52+
# Read the published list rather than `npm view … version`: that
53+
# resolves the `latest` tag, which pre-1.0 can lag behind the newest
54+
# prerelease and would then report an already-published version as new.
55+
VERSIONS_JSON=$(npm view @nanocollective/sentinel versions --json 2>/dev/null || echo "[]")
56+
NPM_VERSION=$(echo "$VERSIONS_JSON" | node -e '
57+
let raw = "";
58+
process.stdin.on("data", d => (raw += d)).on("end", () => {
59+
const parsed = raw.trim() ? JSON.parse(raw) : [];
60+
const versions = Array.isArray(parsed) ? parsed : [parsed];
61+
console.log(versions.at(-1) ?? "0.0.0");
62+
});
63+
')
5264
echo "npm-version=$NPM_VERSION" >> $GITHUB_OUTPUT
5365
54-
if [ "$PACKAGE_VERSION" != "$NPM_VERSION" ]; then
55-
echo "✅ New version: $PACKAGE_VERSION (npm: $NPM_VERSION)"
66+
ALREADY_PUBLISHED=$(echo "$VERSIONS_JSON" | node -e '
67+
let raw = "";
68+
process.stdin.on("data", d => (raw += d)).on("end", () => {
69+
const parsed = raw.trim() ? JSON.parse(raw) : [];
70+
const versions = Array.isArray(parsed) ? parsed : [parsed];
71+
console.log(versions.includes(process.env.PACKAGE_VERSION) ? "yes" : "no");
72+
});
73+
')
74+
75+
if [ "$ALREADY_PUBLISHED" = "no" ]; then
76+
echo "✅ New version: $PACKAGE_VERSION (newest on npm: $NPM_VERSION)"
5677
echo "should-publish=true" >> $GITHUB_OUTPUT
5778
else
58-
echo "ℹ️ No version change: $PACKAGE_VERSION"
79+
echo "ℹ️ Already published: $PACKAGE_VERSION"
5980
echo "should-publish=false" >> $GITHUB_OUTPUT
6081
fi
6182
@@ -113,6 +134,34 @@ jobs:
113134
env:
114135
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
115136

137+
# Pre-1.0 every published version is a prerelease, so it goes out under
138+
# `alpha`/`beta`/`rc` and never claims `latest`. That leaves `latest`
139+
# pinned to whichever version happened to be published without an
140+
# explicit tag — `npx @nanocollective/sentinel` then installs a stale
141+
# build. Keep `latest` on the newest prerelease until a stable version
142+
# ships, at which point `npm publish --tag latest` claims it and this
143+
# step stops firing.
144+
- name: Keep latest on the newest prerelease
145+
if: needs.check-version.outputs.is-prerelease == 'true'
146+
run: |
147+
HAS_STABLE=$(npm view @nanocollective/sentinel versions --json 2>/dev/null | node -e '
148+
let raw = "";
149+
process.stdin.on("data", d => (raw += d)).on("end", () => {
150+
const parsed = raw.trim() ? JSON.parse(raw) : [];
151+
const versions = Array.isArray(parsed) ? parsed : [parsed];
152+
console.log(versions.some(v => !v.includes("-")) ? "yes" : "no");
153+
});
154+
')
155+
if [ "$HAS_STABLE" = "yes" ]; then
156+
echo "ℹ️ A stable version exists — leaving the latest tag alone"
157+
else
158+
npm dist-tag add @nanocollective/sentinel@$VERSION latest
159+
echo "✅ latest now points at $VERSION"
160+
fi
161+
env:
162+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
163+
VERSION: ${{ needs.check-version.outputs.package-version }}
164+
116165
- name: Create GitHub Release
117166
uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65 # v2
118167
with:

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
# 0.1.0-alpha.3
2+
3+
Release plumbing only — no changes to Sentinel itself.
4+
5+
- **`npx @nanocollective/sentinel` installs the newest alpha.** Pre-1.0 releases
6+
publish under the `alpha` tag and never claimed npm's `latest`, which was
7+
still pinned to `0.1.0-alpha.0` — so the documented `npx` install fetched the
8+
first alpha rather than the current one. The release workflow now moves
9+
`latest` onto each new prerelease until a stable version ships and claims the
10+
tag itself.
11+
- **Publish detection no longer trusts the `latest` tag.** The version check
12+
reads the full published-versions list, so a lagging tag can no longer report
13+
an already-published version as new, and the release notes link to the right
14+
compare range.
15+
116
# 0.1.0-alpha.2
217

318
Fixes from running the full audit loop live against a real repository. Several

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nanocollective/sentinel",
3-
"version": "0.1.0-alpha.2",
3+
"version": "0.1.0-alpha.3",
44
"description": "An installable, Nanocoder-driven workflow that runs continuous, configurable security and code audits across a GitHub organisation's repositories and files findings as issues.",
55
"keywords": [
66
"security",

0 commit comments

Comments
 (0)