landlock-run-release.yml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. # Build and publish the @deepseek-ai/node-addon-landlock-run 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: Landlock Run Release
  5. on:
  6. workflow_dispatch:
  7. inputs:
  8. publish:
  9. description: Publish packed tarballs to npm. Must run from a landlock-run-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/landlock-run
  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-landlock-run-workspace... --frozen-lockfile
  52. - name: Install musl toolchain
  53. run: |
  54. sudo apt-get update -q
  55. sudo apt-get install -yq musl-tools
  56. - name: Build native binaries
  57. run: pnpm build:native
  58. - name: Verify binary metadata
  59. run: node ./scripts/verify-launcher-binary.mjs ${{ matrix.dir }}
  60. - name: Upload prebuild artifact
  61. uses: actions/upload-artifact@v4
  62. with:
  63. name: ${{ matrix.artifact }}
  64. path: native/landlock-run/${{ matrix.dir }}/bin/*
  65. if-no-files-found: error
  66. retention-days: 7
  67. pack:
  68. name: Pack npm tarballs
  69. needs: build-prebuilds
  70. runs-on: ubuntu-24.04
  71. steps:
  72. - uses: actions/checkout@v4
  73. - uses: pnpm/action-setup@v4
  74. with:
  75. package_json_file: package.json
  76. - uses: actions/setup-node@v4
  77. with:
  78. node-version: 24
  79. cache: pnpm
  80. cache-dependency-path: pnpm-lock.yaml
  81. - name: Install dependencies
  82. run: pnpm install --filter @deepseek-ai/node-addon-landlock-run-workspace... --frozen-lockfile
  83. - name: Build TypeScript
  84. run: pnpm build:ts
  85. - name: Verify release version
  86. run: node ./scripts/verify-release.mjs
  87. env:
  88. RELEASE_PUBLISH: ${{ inputs.publish }}
  89. - name: Download prebuild artifacts
  90. uses: actions/download-artifact@v4
  91. with:
  92. pattern: prebuild-*
  93. path: native/landlock-run/.release/prebuild-artifacts
  94. - name: Assemble and verify prebuilds
  95. run: node ./scripts/assemble-prebuilds.mjs .release/prebuild-artifacts
  96. - name: Verify release payload
  97. run: node ./scripts/verify-release.mjs --prebuilds
  98. env:
  99. RELEASE_PUBLISH: ${{ inputs.publish }}
  100. - name: Pack release tarballs
  101. run: node ./scripts/pack-release.mjs dist/npm
  102. - name: Verify packed install
  103. run: node ./scripts/verify-packed-install.mjs dist/npm
  104. env:
  105. NALR_REQUIRE_LANDLOCK: 1
  106. - name: Upload npm tarballs
  107. uses: actions/upload-artifact@v4
  108. with:
  109. name: npm-tarballs
  110. path: native/landlock-run/dist/npm/*
  111. if-no-files-found: error
  112. retention-days: 7
  113. publish:
  114. name: Publish to npm
  115. if: inputs.publish
  116. needs: pack
  117. runs-on: ubuntu-24.04
  118. environment: npm-publish
  119. permissions:
  120. contents: read
  121. id-token: write
  122. steps:
  123. # The publish script is the only repository file this job needs, and it
  124. # imports nothing outside Node's builtins, so there is no install step.
  125. - uses: actions/checkout@v4
  126. with:
  127. persist-credentials: false
  128. - uses: actions/setup-node@v4
  129. with:
  130. node-version: 24
  131. registry-url: https://registry.npmjs.org
  132. - name: Download npm tarballs
  133. uses: actions/download-artifact@v4
  134. with:
  135. name: npm-tarballs
  136. path: native/landlock-run/dist/npm
  137. - name: Configure npm token fallback
  138. env:
  139. NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
  140. run: |
  141. if [[ -n "$NPM_TOKEN" ]]; then
  142. echo "NODE_AUTH_TOKEN=$NPM_TOKEN" >> "$GITHUB_ENV"
  143. fi
  144. - name: Publish tarballs
  145. # Publication is decided per package against the registry, so re-running
  146. # this job over the same artifact skips what already landed instead of
  147. # failing on it. A bare `npm publish` loop could not be retried: the
  148. # registry answers a repeat of an existing version permanently.
  149. run: node ./scripts/publish-release.mjs dist/npm