1- name : Publish to npm
2- # Publishes squad-sdk and squad-cli to npm with provenance
3-
1+ name : Squad npm Publish
42on :
53 release :
64 types : [published]
75 workflow_dispatch :
86 inputs :
97 version :
10- description : ' Version to publish (e.g., 0.8.21 )'
8+ description : ' Version to publish (e.g., 0.9.1 )'
119 required : true
1210 type : string
13-
1411permissions :
1512 contents : read
1613 id-token : write
17-
1814jobs :
1915 smoke-test :
2016 name : CLI packaging smoke test
@@ -23,22 +19,17 @@ jobs:
2319 - uses : actions/checkout@v4
2420 with :
2521 fetch-depth : 0
26-
2722 - uses : actions/setup-node@v4
2823 with :
2924 node-version : 22
30-
3125 - name : Install dependencies
3226 run : npm ci
33-
3427 - name : Build
3528 run : npm run build
3629 env :
3730 SKIP_BUILD_BUMP : ' 1'
38-
3931 - name : Run CLI smoke tests
4032 run : npx vitest run test/cli-packaging-smoke.test.ts
41-
4233 publish-sdk :
4334 name : Publish @bradygaster/squad-sdk
4435 needs : smoke-test
@@ -47,12 +38,10 @@ jobs:
4738 - uses : actions/checkout@v4
4839 with :
4940 fetch-depth : 0
50-
5141 - uses : actions/setup-node@v4
5242 with :
5343 node-version : 22
5444 registry-url : ' https://registry.npmjs.org'
55-
5645 - name : Determine version
5746 id : version
5847 run : |
@@ -63,41 +52,34 @@ jobs:
6352 VERSION="${{ github.event.inputs.version }}"
6453 fi
6554 echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
66- echo "📦 Publishing version: ${VERSION}"
67-
55+ echo "Publishing version: ${VERSION}"
6856 - name : Install dependencies
6957 run : npm ci
70-
7158 - name : Build squad-sdk
7259 run : npm -w packages/squad-sdk run build
73-
7460 - name : Verify package version matches target
7561 run : |
7662 PKG_VERSION=$(node -p "require('./packages/squad-sdk/package.json').version")
7763 if [[ "$PKG_VERSION" != "${{ steps.version.outputs.version }}" ]]; then
7864 echo "::error::Package version ($PKG_VERSION) does not match target version (${{ steps.version.outputs.version }})"
7965 exit 1
8066 fi
81- echo "✅ Package version matches: $PKG_VERSION"
82-
67+ echo "Package version matches: $PKG_VERSION"
8368 - name : Publish squad-sdk to npm
8469 run : npm -w packages/squad-sdk publish --access public --provenance
8570 env :
8671 NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
87-
8872 - name : Verify npm publication
8973 run : |
90- echo "✅ @bradygaster/squad-sdk@${{ steps.version.outputs.version }} published to npm"
9174 for i in 1 2 3 4 5; do
9275 if npm view @bradygaster/squad-sdk@${{ steps.version.outputs.version }} version 2>/dev/null; then
93- echo "✅ Verified on npm registry"
76+ echo "Verified on npm registry"
9477 exit 0
9578 fi
96- echo "⏳ Registry propagation attempt $i/5, waiting 15s..."
79+ echo "Registry propagation attempt $i/5, waiting 15s..."
9780 sleep 15
9881 done
99- echo "⚠️ Registry propagation slow — package was published successfully, verification timed out"
100-
82+ echo "Registry propagation slow but package was published successfully"
10183 publish-cli :
10284 name : Publish @bradygaster/squad-cli
10385 needs : [smoke-test, publish-sdk]
@@ -106,12 +88,10 @@ jobs:
10688 - uses : actions/checkout@v4
10789 with :
10890 fetch-depth : 0
109-
11091 - uses : actions/setup-node@v4
11192 with :
11293 node-version : 22
11394 registry-url : ' https://registry.npmjs.org'
114-
11595 - name : Determine version
11696 id : version
11797 run : |
@@ -122,49 +102,41 @@ jobs:
122102 VERSION="${{ github.event.inputs.version }}"
123103 fi
124104 echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
125- echo "📦 Publishing version: ${VERSION}"
126-
105+ echo "Publishing version: ${VERSION}"
127106 - name : Install dependencies
128107 run : npm ci
129-
130108 - name : Guard against file: dependencies
131109 run : |
132110 SDK_DEP=$(node -p "require('./packages/squad-cli/package.json').dependencies['@bradygaster/squad-sdk']")
133111 if [[ "$SDK_DEP" == file:* ]]; then
134112 echo "::error::squad-cli has file: dependency on squad-sdk — this breaks global installs"
135113 exit 1
136114 fi
137- echo "✅ SDK dependency is safe: $SDK_DEP"
138-
115+ echo "SDK dependency is safe: $SDK_DEP"
139116 - name : Build squad-sdk (required for CLI project references)
140117 run : npm -w packages/squad-sdk run build
141-
142118 - name : Build squad-cli
143119 run : npm -w packages/squad-cli run build
144-
145120 - name : Verify package version matches target
146121 run : |
147122 PKG_VERSION=$(node -p "require('./packages/squad-cli/package.json').version")
148123 if [[ "$PKG_VERSION" != "${{ steps.version.outputs.version }}" ]]; then
149124 echo "::error::Package version ($PKG_VERSION) does not match target version (${{ steps.version.outputs.version }})"
150125 exit 1
151126 fi
152- echo "✅ Package version matches: $PKG_VERSION"
153-
127+ echo "Package version matches: $PKG_VERSION"
154128 - name : Publish squad-cli to npm
155129 run : npm -w packages/squad-cli publish --access public --provenance
156130 env :
157131 NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
158-
159132 - name : Verify npm publication
160133 run : |
161- echo "✅ @bradygaster/squad-cli@${{ steps.version.outputs.version }} published to npm"
162134 for i in 1 2 3 4 5; do
163135 if npm view @bradygaster/squad-cli@${{ steps.version.outputs.version }} version 2>/dev/null; then
164- echo "✅ Verified on npm registry"
136+ echo "Verified on npm registry"
165137 exit 0
166138 fi
167- echo "⏳ Registry propagation attempt $i/5, waiting 15s..."
139+ echo "Registry propagation attempt $i/5, waiting 15s..."
168140 sleep 15
169141 done
170- echo "⚠️ Registry propagation slow — package was published successfully, verification timed out "
142+ echo "Registry propagation slow but package was published successfully"
0 commit comments