mirror of
https://github.com/deepseek-ai/deepseek-harness
synced 2026-08-15 21:04:50 +00:00
A landlock publication failed with `E409 Failed to save packument` on the second of three packages. The registry answers a write it could not commit that way, and publishing several packages back to back is what provokes it. Neither publish path could recover. The native sequence published from a shell loop of bare `npm publish` calls: no retry, and no way to resume, because the registry rejects a repeat of an existing version permanently — so a failure partway through left the release stuck. publish.ts skipped versions already present, which made a re-run safe, but had no retry either. Both paths now attempt a tarball up to four times, space writes at least two seconds apart, and back off 2s/4s/8s between attempts. Every retry re-reads the registry first, because a reported failure can answer a write that landed anyway: a version that now exists with this tarball's integrity counts as published rather than as one to place again. That same re-read is what turns a mid-run `E403 cannot publish over the previously published versions` into a skip when the bytes match, and leaves it a hard failure when they do not. The native sequence gets the registry comparison publish.ts already had, through its own script rather than shared code — the two sequences keep separate publication paths. Its publish job now checks out the repository, which the shell loop did not need. Verified against a scripted registry: a clean publish, one E409 then success, an E409 whose write landed anyway, E409 on every attempt (fails after four), and a version already present with matching integrity (publishes nothing).
181 lines
5.2 KiB
YAML
181 lines
5.2 KiB
YAML
# Build and publish the @deepseek-ai/node-addon-landlock-run package family from the
|
|
# harness source of record. Rehearsal and publication consume the same packed
|
|
# tarballs; each native binary is built on its matching architecture.
|
|
name: Landlock Run Release
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
publish:
|
|
description: Publish packed tarballs to npm. Must run from a landlock-run-v* tag.
|
|
required: true
|
|
type: boolean
|
|
default: false
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
# Stable/prerelease dist-tags are shared registry state; serialize release
|
|
# runs so two versions cannot race the final tag assignment.
|
|
group: ${{ github.workflow }}
|
|
cancel-in-progress: false
|
|
|
|
defaults:
|
|
run:
|
|
working-directory: native/landlock-run
|
|
|
|
jobs:
|
|
matrix:
|
|
name: Matrix
|
|
runs-on: ubuntu-24.04
|
|
outputs:
|
|
prebuilds: ${{ steps.matrix.outputs.prebuilds }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- id: matrix
|
|
run: echo "prebuilds=$(node ./scripts/github-matrix.mjs release-prebuild)" >> "$GITHUB_OUTPUT"
|
|
|
|
build-prebuilds:
|
|
name: ${{ matrix.package }}
|
|
needs: matrix
|
|
runs-on: ${{ matrix.runner }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix: ${{ fromJson(needs.matrix.outputs.prebuilds) }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: pnpm/action-setup@v4
|
|
with:
|
|
package_json_file: package.json
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 24
|
|
cache: pnpm
|
|
cache-dependency-path: pnpm-lock.yaml
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --filter @deepseek-ai/node-addon-landlock-run-workspace... --frozen-lockfile
|
|
|
|
- name: Install musl toolchain
|
|
run: |
|
|
sudo apt-get update -q
|
|
sudo apt-get install -yq musl-tools
|
|
|
|
- name: Build native binaries
|
|
run: pnpm build:native
|
|
|
|
- name: Verify binary metadata
|
|
run: node ./scripts/verify-launcher-binary.mjs ${{ matrix.dir }}
|
|
|
|
- name: Upload prebuild artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ matrix.artifact }}
|
|
path: native/landlock-run/${{ matrix.dir }}/bin/*
|
|
if-no-files-found: error
|
|
retention-days: 7
|
|
|
|
pack:
|
|
name: Pack npm tarballs
|
|
needs: build-prebuilds
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: pnpm/action-setup@v4
|
|
with:
|
|
package_json_file: package.json
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 24
|
|
cache: pnpm
|
|
cache-dependency-path: pnpm-lock.yaml
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --filter @deepseek-ai/node-addon-landlock-run-workspace... --frozen-lockfile
|
|
|
|
- name: Build TypeScript
|
|
run: pnpm build:ts
|
|
|
|
- name: Verify release version
|
|
run: node ./scripts/verify-release.mjs
|
|
env:
|
|
RELEASE_PUBLISH: ${{ inputs.publish }}
|
|
|
|
- name: Download prebuild artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
pattern: prebuild-*
|
|
path: native/landlock-run/.release/prebuild-artifacts
|
|
|
|
- name: Assemble and verify prebuilds
|
|
run: node ./scripts/assemble-prebuilds.mjs .release/prebuild-artifacts
|
|
|
|
- name: Verify release payload
|
|
run: node ./scripts/verify-release.mjs --prebuilds
|
|
env:
|
|
RELEASE_PUBLISH: ${{ inputs.publish }}
|
|
|
|
- name: Pack release tarballs
|
|
run: node ./scripts/pack-release.mjs dist/npm
|
|
|
|
- name: Verify packed install
|
|
run: node ./scripts/verify-packed-install.mjs dist/npm
|
|
env:
|
|
NALR_REQUIRE_LANDLOCK: 1
|
|
|
|
- name: Upload npm tarballs
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: npm-tarballs
|
|
path: native/landlock-run/dist/npm/*
|
|
if-no-files-found: error
|
|
retention-days: 7
|
|
|
|
publish:
|
|
name: Publish to npm
|
|
if: inputs.publish
|
|
needs: pack
|
|
runs-on: ubuntu-24.04
|
|
environment: npm-publish
|
|
permissions:
|
|
contents: read
|
|
id-token: write
|
|
steps:
|
|
# The publish script is the only repository file this job needs, and it
|
|
# imports nothing outside Node's builtins, so there is no install step.
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 24
|
|
registry-url: https://registry.npmjs.org
|
|
|
|
- name: Download npm tarballs
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: npm-tarballs
|
|
path: native/landlock-run/dist/npm
|
|
|
|
- name: Configure npm token fallback
|
|
env:
|
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
run: |
|
|
if [[ -n "$NPM_TOKEN" ]]; then
|
|
echo "NODE_AUTH_TOKEN=$NPM_TOKEN" >> "$GITHUB_ENV"
|
|
fi
|
|
|
|
- name: Publish tarballs
|
|
# Publication is decided per package against the registry, so re-running
|
|
# this job over the same artifact skips what already landed instead of
|
|
# failing on it. A bare `npm publish` loop could not be retried: the
|
|
# registry answers a repeat of an existing version permanently.
|
|
run: node ./scripts/publish-release.mjs dist/npm
|