Skip to content

Commit 528e60a

Browse files
authored
fix(publish): make the npm release idempotent and verify it installs (#5633)
1 parent a131e08 commit 528e60a

65 files changed

Lines changed: 468 additions & 124 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/publish.yaml

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
push:
55
tags:
66
- "v*"
7+
# Nightly tags (v0.7.1-nightly.20260904.762) also match "v*". They are
8+
# built daily and are not release artifacts, so keep them off the registry.
9+
- "!v*-nightly.*"
710
workflow_dispatch:
811
inputs:
912
version:
@@ -73,10 +76,55 @@ jobs:
7376
- name: Publish to npm
7477
env:
7578
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
79+
run: node scripts/publish-packages.mjs --tag "$NPM_TAG"
80+
81+
- name: Record published version
82+
id: published
83+
run: echo "version=${VERSION_NO_V}" >> "$GITHUB_OUTPUT"
84+
85+
outputs:
86+
version: ${{ steps.published.outputs.version }}
87+
88+
# Nothing before this point proves the published tarballs install and run.
89+
# rc.11 sat on the "latest" dist-tag for months while every later release
90+
# failed, and no check noticed.
91+
smoke:
92+
needs: publish
93+
runs-on: ubuntu-latest
94+
steps:
95+
- name: Set up Node.js
96+
uses: actions/setup-node@v6
97+
with:
98+
node-version: "22"
99+
registry-url: "https://registry.npmjs.org"
100+
101+
- name: Install system libraries (keytar/libsecret)
102+
run: sudo apt-get update && sudo apt-get install -y libsecret-1-dev
103+
104+
- name: Install the published CLI from the registry
105+
run: |
106+
mkdir -p /tmp/cli-smoke && cd /tmp/cli-smoke
107+
npm init -y > /dev/null
108+
npm install "@nodetool-ai/cli@${{ needs.publish.outputs.version }}"
109+
110+
- name: Verify the CLI reports its real version and runs
76111
run: |
77-
npm publish \
78-
--workspaces \
79-
--access public \
80-
--ignore-scripts \
81-
--provenance \
82-
--tag "$NPM_TAG"
112+
cd /tmp/cli-smoke
113+
ACTUAL="$(./node_modules/.bin/nodetool --version)"
114+
EXPECTED="${{ needs.publish.outputs.version }}"
115+
if [ "$ACTUAL" != "$EXPECTED" ]; then
116+
echo "nodetool --version reported '$ACTUAL', expected '$EXPECTED'"
117+
exit 1
118+
fi
119+
# `nodetool validate --help` is not a usable check: commander's
120+
# --help short-circuits before unknown-command handling, so it prints
121+
# top-level help and exits 0 even when the command is absent (rc.11
122+
# does exactly that). Assert the command is listed instead.
123+
./node_modules/.bin/nodetool --help > /tmp/cli-smoke/help.txt
124+
for cmd in validate debug node harness; do
125+
if ! grep -qE "^ $cmd( |$)" /tmp/cli-smoke/help.txt; then
126+
echo "published CLI is missing the '$cmd' command"
127+
cat /tmp/cli-smoke/help.txt
128+
exit 1
129+
fi
130+
done

0 commit comments

Comments
 (0)