release.yml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. # Pack and publish the dsh release sequence: every package under packages/ plus
  2. # the apps/ entries, all on one version. The vendored framework and the native
  3. # packages are separate sequences with their own workflows and version lines.
  4. #
  5. # Pack runs without credentials on every pull request and master push, so a
  6. # pull request proves the whole publish set still packs. Publication is a
  7. # manual dispatch from a dsh-v* tag and consumes exactly the packed bytes.
  8. name: Release (dsh)
  9. on:
  10. pull_request:
  11. push:
  12. branches: [master]
  13. workflow_dispatch:
  14. inputs:
  15. publish:
  16. description: Publish the packed tarballs to npm. Must run from a dsh-v* tag.
  17. required: true
  18. type: boolean
  19. default: false
  20. permissions:
  21. contents: read
  22. concurrency:
  23. # dist-tags are shared registry state; never race two release runs.
  24. group: ${{ github.workflow }}
  25. cancel-in-progress: false
  26. env:
  27. PRIMARY_NODE_VERSION: '24'
  28. DSH_TELEMETRY_DISABLED: '1'
  29. jobs:
  30. pack:
  31. name: Pack npm tarballs
  32. runs-on: ubuntu-24.04
  33. steps:
  34. # Complete history: the release scripts read tags.
  35. - uses: actions/checkout@v6
  36. with:
  37. fetch-depth: 0
  38. persist-credentials: false
  39. - uses: pnpm/action-setup@v4
  40. with:
  41. dest: ${{ runner.temp }}/setup-pnpm
  42. - uses: actions/setup-node@v6
  43. with:
  44. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  45. - name: Configure pnpm store path
  46. id: pnpm-store
  47. run: |
  48. store_root="$HOME/.local/share/pnpm/store"
  49. echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV"
  50. store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent)
  51. echo "path=$store_path" >> "$GITHUB_OUTPUT"
  52. - uses: actions/cache/restore@v4
  53. with:
  54. path: ${{ steps.pnpm-store.outputs.path }}
  55. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  56. restore-keys: |
  57. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  58. - name: Install (immutable)
  59. run: pnpm install --frozen-lockfile
  60. - name: Verify release version
  61. env:
  62. RELEASE_PUBLISH: ${{ inputs.publish }}
  63. run: pnpm run release:verify --family dsh
  64. - name: Build
  65. run: pnpm run build
  66. - name: Pack release tarballs
  67. run: pnpm run release:pack --family dsh --out dist/npm
  68. # The harness packages declare the vendored framework as a peer, and this
  69. # job has no credentials for the private registry, so the verification
  70. # installs that family's pack output too. Only dist/npm is published.
  71. - name: Pack the vendored framework for verification
  72. run: pnpm run release:pack --family vendor --out dist/npm-vendor
  73. - name: Verify packed install
  74. run: pnpm run release:verify-packed-install --family dsh --from dist/npm --from dist/npm-vendor
  75. - uses: actions/upload-artifact@v4
  76. with:
  77. name: dsh-npm-tarballs
  78. path: dist/npm/*
  79. if-no-files-found: error
  80. retention-days: 7
  81. publish:
  82. name: Publish to npm
  83. if: inputs.publish
  84. needs: pack
  85. runs-on: ubuntu-24.04
  86. # Required reviewers and the allowed tags live on the environment; this is
  87. # the only step in the sequence that can write to the registry.
  88. environment: npm-publish
  89. permissions:
  90. contents: read
  91. id-token: write
  92. steps:
  93. # Checkout and install carry the release scripts only. There is no build
  94. # step: publication uploads the bytes the pack job produced.
  95. - uses: actions/checkout@v6
  96. with:
  97. persist-credentials: false
  98. - uses: pnpm/action-setup@v4
  99. with:
  100. dest: ${{ runner.temp }}/setup-pnpm
  101. - uses: actions/setup-node@v6
  102. with:
  103. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  104. registry-url: https://registry.npmjs.org
  105. - name: Install (immutable, no package scripts)
  106. run: pnpm install --frozen-lockfile --ignore-scripts
  107. - uses: actions/download-artifact@v4
  108. with:
  109. name: dsh-npm-tarballs
  110. path: dist/npm
  111. - name: Publish tarballs
  112. env:
  113. NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
  114. run: pnpm run release:publish --family dsh --from dist/npm