release-publish.yml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. # Publish the dsh release sequence to npm. This workflow is manual-only
  2. # (workflow_dispatch) and intentionally does not listen to pull_request or push:
  3. # publication must always be an explicit, reviewed act from a dsh-v* tag, and it
  4. # must never appear as a PR check. It repacks the current tree before publishing
  5. # so the bytes uploaded are exactly what this dispatch produced.
  6. name: Release publish (dsh)
  7. on:
  8. workflow_dispatch:
  9. permissions:
  10. contents: read
  11. env:
  12. PRIMARY_NODE_VERSION: '24'
  13. DSH_TELEMETRY_DISABLED: '1'
  14. jobs:
  15. pack:
  16. name: Pack npm tarballs
  17. runs-on: ubuntu-24.04
  18. steps:
  19. # Complete history: the release scripts read tags.
  20. - uses: actions/checkout@v6
  21. with:
  22. fetch-depth: 0
  23. persist-credentials: false
  24. - uses: pnpm/action-setup@v4
  25. with:
  26. dest: ${{ runner.temp }}/setup-pnpm
  27. - uses: actions/setup-node@v6
  28. with:
  29. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  30. - name: Configure pnpm store path
  31. id: pnpm-store
  32. run: |
  33. store_root="$HOME/.local/share/pnpm/store"
  34. echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV"
  35. store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent)
  36. echo "path=$store_path" >> "$GITHUB_OUTPUT"
  37. - uses: actions/cache/restore@v4
  38. with:
  39. path: ${{ steps.pnpm-store.outputs.path }}
  40. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  41. restore-keys: |
  42. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  43. - name: Install (immutable)
  44. run: pnpm install --frozen-lockfile
  45. - name: Verify release version
  46. env:
  47. RELEASE_PUBLISH: 'true'
  48. run: pnpm run release:verify --family dsh
  49. - name: Build
  50. run: pnpm run build:official
  51. - name: Pack release tarballs
  52. run: pnpm run release:pack --family dsh --out dist/npm
  53. # The harness packages declare the vendored framework as a peer, and this
  54. # verification must not depend on the registry already carrying matching
  55. # versions — one pull request may bump both families before either
  56. # publishes — so it installs that family's pack output too. Only dist/npm
  57. # is published.
  58. - name: Pack the vendored framework for verification
  59. run: pnpm run release:pack --family vendor --out dist/npm-vendor
  60. # dsh-sandbox-local declares the Landlock entry as a runtime dependency, so
  61. # the verification needs its tarball. Its platform packages stay out: they
  62. # are optional, and building them needs a musl toolchain per architecture.
  63. - name: Pack the Landlock entry for verification
  64. run: |
  65. pnpm --dir native/system run build:ts
  66. pnpm --dir native/system/packages/entry pack --pack-destination "$PWD/dist/npm-landlock"
  67. - name: Verify packed install
  68. run: pnpm run release:verify-packed-install --family dsh --from dist/npm --from dist/npm-vendor --from dist/npm-landlock
  69. - uses: actions/upload-artifact@v4
  70. with:
  71. name: dsh-npm-tarballs
  72. path: dist/npm/*
  73. if-no-files-found: error
  74. retention-days: 7
  75. publish:
  76. name: Publish to npm
  77. needs: pack
  78. runs-on: ubuntu-24.04
  79. # Required reviewers and the allowed tags live on the environment; this is
  80. # the only job in the sequence that can write to the registry.
  81. environment: npm-publish
  82. concurrency:
  83. group: Release-publish
  84. cancel-in-progress: false
  85. permissions:
  86. contents: read
  87. steps:
  88. # Checkout and install carry the release scripts only. There is no build
  89. # step: publication uploads the bytes the pack job produced.
  90. - uses: actions/checkout@v6
  91. with:
  92. persist-credentials: false
  93. - uses: pnpm/action-setup@v4
  94. with:
  95. dest: ${{ runner.temp }}/setup-pnpm
  96. - uses: actions/setup-node@v6
  97. with:
  98. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  99. registry-url: https://registry.npmjs.org
  100. - name: Install (immutable, no package scripts)
  101. run: pnpm install --frozen-lockfile --ignore-scripts
  102. - uses: actions/download-artifact@v4
  103. with:
  104. name: dsh-npm-tarballs
  105. path: dist/npm
  106. - name: Publish tarballs
  107. env:
  108. NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
  109. run: pnpm run release:publish --family dsh --from dist/npm