1
0

node-addon-system-release.yml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. # Build and publish the @deepseek-ai/node-addon-system package family from the
  2. # harness source of record. Rehearsal and publication consume the same packed
  3. # tarballs; each native binary is built on its matching architecture.
  4. name: Node Addon System Release
  5. on:
  6. workflow_dispatch:
  7. inputs:
  8. publish:
  9. description: Publish packed tarballs to npm. Must run from a node-addon-system-v* tag.
  10. required: true
  11. type: boolean
  12. default: false
  13. permissions:
  14. contents: read
  15. concurrency:
  16. # Stable/prerelease dist-tags are shared registry state; serialize release
  17. # runs so two versions cannot race the final tag assignment.
  18. group: ${{ github.workflow }}
  19. cancel-in-progress: false
  20. defaults:
  21. run:
  22. working-directory: native/system
  23. jobs:
  24. matrix:
  25. name: Matrix
  26. runs-on: ubuntu-24.04
  27. outputs:
  28. prebuilds: ${{ steps.matrix.outputs.prebuilds }}
  29. steps:
  30. - uses: actions/checkout@v4
  31. - id: matrix
  32. run: echo "prebuilds=$(node ./scripts/github-matrix.mjs release-prebuild)" >> "$GITHUB_OUTPUT"
  33. build-prebuilds:
  34. name: ${{ matrix.package }}
  35. needs: matrix
  36. runs-on: ${{ matrix.runner }}
  37. strategy:
  38. fail-fast: false
  39. matrix: ${{ fromJson(needs.matrix.outputs.prebuilds) }}
  40. steps:
  41. - uses: actions/checkout@v4
  42. - uses: pnpm/action-setup@v4
  43. with:
  44. package_json_file: package.json
  45. - uses: actions/setup-node@v4
  46. with:
  47. node-version: 24
  48. cache: pnpm
  49. cache-dependency-path: pnpm-lock.yaml
  50. - name: Install dependencies
  51. run: pnpm install --filter @deepseek-ai/node-addon-system-workspace... --frozen-lockfile
  52. - name: Install musl toolchain
  53. if: runner.os == 'Linux'
  54. run: |
  55. sudo apt-get update -q
  56. sudo apt-get install -yq musl-tools
  57. - name: Build native binaries
  58. run: pnpm build:native
  59. - name: Verify binary metadata
  60. run: node ./scripts/verify-launcher-binary.mjs ${{ matrix.dir }}
  61. - name: Verify the built entry and flock
  62. run: |
  63. pnpm build:ts
  64. pnpm build:test-oracle
  65. pnpm test:flock
  66. pnpm test:packaging
  67. - name: Upload prebuild artifact
  68. uses: actions/upload-artifact@v4
  69. with:
  70. name: ${{ matrix.artifact }}
  71. path: native/system/${{ matrix.dir }}/bin/**
  72. if-no-files-found: error
  73. retention-days: 7
  74. pack:
  75. name: Pack npm tarballs
  76. needs: build-prebuilds
  77. runs-on: ubuntu-24.04
  78. steps:
  79. - uses: actions/checkout@v4
  80. - uses: pnpm/action-setup@v4
  81. with:
  82. package_json_file: package.json
  83. - uses: actions/setup-node@v4
  84. with:
  85. node-version: 24
  86. cache: pnpm
  87. cache-dependency-path: pnpm-lock.yaml
  88. - name: Install dependencies
  89. run: pnpm install --filter @deepseek-ai/node-addon-system-workspace... --frozen-lockfile
  90. - name: Build TypeScript
  91. run: pnpm build:ts
  92. - name: Verify release version
  93. run: node ./scripts/verify-release.mjs
  94. env:
  95. RELEASE_PUBLISH: ${{ inputs.publish }}
  96. - name: Download prebuild artifacts
  97. uses: actions/download-artifact@v4
  98. with:
  99. pattern: prebuild-*
  100. path: native/system/.release/prebuild-artifacts
  101. - name: Assemble and verify prebuilds
  102. run: node ./scripts/assemble-prebuilds.mjs .release/prebuild-artifacts
  103. - name: Verify release payload
  104. run: node ./scripts/verify-release.mjs --prebuilds
  105. env:
  106. RELEASE_PUBLISH: ${{ inputs.publish }}
  107. - name: Pack release tarballs
  108. run: node ./scripts/pack-release.mjs dist/npm
  109. - name: Verify packed install
  110. run: node ./scripts/verify-packed-install.mjs dist/npm
  111. env:
  112. NALR_REQUIRE_LANDLOCK: 1
  113. - name: Upload npm tarballs
  114. uses: actions/upload-artifact@v4
  115. with:
  116. name: npm-tarballs
  117. path: native/system/dist/npm/*
  118. if-no-files-found: error
  119. retention-days: 7
  120. publish:
  121. name: Publish to npm
  122. if: inputs.publish
  123. needs: pack
  124. runs-on: ubuntu-24.04
  125. environment: npm-publish
  126. permissions:
  127. contents: read
  128. id-token: write
  129. steps:
  130. # The publish script is the only repository file this job needs, and it
  131. # imports nothing outside Node's builtins, so there is no install step.
  132. - uses: actions/checkout@v4
  133. with:
  134. persist-credentials: false
  135. - uses: actions/setup-node@v4
  136. with:
  137. node-version: 24
  138. registry-url: https://registry.npmjs.org
  139. - name: Download npm tarballs
  140. uses: actions/download-artifact@v4
  141. with:
  142. name: npm-tarballs
  143. path: native/system/dist/npm
  144. - name: Configure npm token fallback
  145. env:
  146. NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
  147. run: |
  148. if [[ -n "$NPM_TOKEN" ]]; then
  149. echo "NODE_AUTH_TOKEN=$NPM_TOKEN" >> "$GITHUB_ENV"
  150. fi
  151. - name: Publish tarballs
  152. # Publication is decided per package against the registry, so re-running
  153. # this job over the same artifact skips what already landed instead of
  154. # failing on it. A bare `npm publish` loop could not be retried: the
  155. # registry answers a repeat of an existing version permanently.
  156. run: node ./scripts/publish-release.mjs dist/npm