@@ -246,13 +246,11 @@ jobs: |
246 | 246 | path: packages/process-daemon/dist/*.tar.gz |
247 | 247 | if-no-files-found: error |
248 | 248 |
|
249 | | - release: |
| 249 | + package: |
250 | 250 | needs: [checks, build, build-windows] |
251 | 251 | runs-on: ubuntu-22.04 |
252 | | - permissions: |
253 | | - contents: write |
254 | | - id-token: write |
255 | | - attestations: write |
| 252 | + outputs: |
| 253 | + digest: ${{ steps.upload.outputs.digest }} |
256 | 254 | env: |
257 | 255 | PROTOCOL_VERSION: ${{ needs.checks.outputs.protocol }} |
258 | 256 | steps: |
@@ -261,8 +259,6 @@ jobs: |
261 | 259 | with: |
262 | 260 | node-version: "24" |
263 | 261 | registry-url: https://registry.npmjs.org |
264 | | - - name: Install npm with trusted publishing support |
265 | | - run: npm install --global npm@^11.5.1 |
266 | 262 | - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 |
267 | 263 | with: |
268 | 264 | path: packages/process-daemon/dist |
@@ -297,35 +293,68 @@ jobs: |
297 | 293 | npm pack --pack-destination "$temporary" dist/npm/opencode-pty-linux-x64-gnu dist/npm/opencode-pty >/dev/null |
298 | 294 | npm install --prefix "$temporary" --ignore-scripts --no-package-lock --no-audit --no-fund "$temporary"/*.tgz |
299 | 295 | test "$("$temporary/node_modules/.bin/opencode-pty" --version)" = "opencode-pty $(node -p 'require("./npm/package.json").version') (protocol $PROTOCOL_VERSION)" |
| 296 | + - name: Stage release files |
| 297 | + run: | |
| 298 | + mkdir -p "$RUNNER_TEMP/bundle/github" "$RUNNER_TEMP/bundle/npm" |
| 299 | + cp dist/*.tar.gz dist/release-manifest.json dist/SHA256SUMS "$RUNNER_TEMP/bundle/github/" |
| 300 | + for package in dist/npm/*; do |
| 301 | + npm pack --ignore-scripts --pack-destination "$RUNNER_TEMP/bundle/npm" "$(realpath "$package")" |
| 302 | + done |
| 303 | + # The upload action owns the outer SHA256SUMS; include the release checksums in it. |
| 304 | + mv "$RUNNER_TEMP/bundle/github/SHA256SUMS" "$RUNNER_TEMP/bundle/github/checksums.txt" |
| 305 | + - id: upload |
| 306 | + uses: ./.github/release/upload |
| 307 | + with: |
| 308 | + name: process-daemon-bundle |
| 309 | + path: ${{ runner.temp }}/bundle |
| 310 | + |
| 311 | + release: |
| 312 | + needs: [checks, package] |
| 313 | + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/process-daemon-v') |
| 314 | + runs-on: ubuntu-24.04 |
| 315 | + environment: process-daemon-release |
| 316 | + permissions: |
| 317 | + contents: write |
| 318 | + id-token: write |
| 319 | + attestations: write |
| 320 | + defaults: |
| 321 | + run: |
| 322 | + working-directory: . |
| 323 | + env: |
| 324 | + PROTOCOL_VERSION: ${{ needs.checks.outputs.protocol }} |
| 325 | + steps: |
| 326 | + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 |
| 327 | + with: |
| 328 | + sparse-checkout: /.github/release/ |
| 329 | + sparse-checkout-cone-mode: false |
| 330 | + persist-credentials: false |
| 331 | + - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0; caching opt-in |
| 332 | + with: |
| 333 | + node-version: '24.11.0' |
| 334 | + - uses: ./.github/release/download |
| 335 | + with: |
| 336 | + pattern: process-daemon-bundle |
| 337 | + digests: process-daemon-bundle=${{ needs.package.outputs.digest }} |
| 338 | + require-digests: 'true' |
300 | 339 | - uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6 # v4.2.2 |
301 | | - if: startsWith(github.ref, 'refs/tags/process-daemon-v') |
302 | 340 | with: |
303 | | - subject-checksums: packages/process-daemon/dist/SHA256SUMS |
| 341 | + subject-path: | |
| 342 | + ${{ runner.temp }}/in/process-daemon-bundle/github/*.tar.gz |
| 343 | + ${{ runner.temp }}/in/process-daemon-bundle/github/release-manifest.json |
304 | 344 | # The monorepo's Latest release drives OpenCode's own update paths, so this release must never become |
305 | 345 | # Latest. It is drafted first because immutable releases lock assets once published. |
306 | 346 | - name: Publish release |
307 | | - if: startsWith(github.ref, 'refs/tags/process-daemon-v') |
308 | 347 | env: |
309 | 348 | GH_TOKEN: ${{ github.token }} |
310 | 349 | run: | |
| 350 | + cd "$RUNNER_TEMP/in/process-daemon-bundle/github" |
| 351 | + mv checksums.txt SHA256SUMS |
311 | 352 | version="${GITHUB_REF_NAME#process-daemon-v}" |
312 | 353 | gh release view "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1 || |
313 | 354 | gh release create "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" --draft --verify-tag --latest=false \ |
314 | 355 | --title "process-daemon v$version" \ |
315 | 356 | --notes "opencode-pty $version (protocol $PROTOCOL_VERSION) from packages/process-daemon, published to npm as @opencode/pty@$version." |
316 | | - gh release upload "$GITHUB_REF_NAME" dist/*.tar.gz dist/SHA256SUMS dist/release-manifest.json --clobber --repo "$GITHUB_REPOSITORY" |
| 357 | + gh release upload "$GITHUB_REF_NAME" ./*.tar.gz SHA256SUMS release-manifest.json --clobber --repo "$GITHUB_REPOSITORY" |
317 | 358 | gh release edit "$GITHUB_REF_NAME" --draft=false --latest=false --repo "$GITHUB_REPOSITORY" |
318 | 359 | - name: Publish npm packages |
319 | | - if: startsWith(github.ref, 'refs/tags/process-daemon-v') |
320 | | - run: | |
321 | | - version="${GITHUB_REF_NAME#process-daemon-v}" |
322 | | - for package in dist/npm/opencode-pty-*; do |
323 | | - name="$(node -p 'require(process.argv[1]).name' "$(realpath "$package/package.json")")" |
324 | | - if ! npm view "$name@$version" version >/dev/null 2>&1; then |
325 | | - npm publish "$package" --access public --provenance |
326 | | - fi |
327 | | - done |
328 | | - name="@opencode/pty" |
329 | | - if ! npm view "$name@$version" version >/dev/null 2>&1; then |
330 | | - npm publish dist/npm/opencode-pty --access public --provenance |
331 | | - fi |
| 360 | + run: bash .github/release/publish-process-daemon.sh "$RUNNER_TEMP/in/process-daemon-bundle/npm" |