release-vendor.yml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. # Pack and publish the vendored framework sequence: the nine rescoped Cordis
  2. # packages under vendor/, each on its own version line. This sequence releases
  3. # independently of dsh and of the native packages.
  4. #
  5. # Pack runs without credentials on every pull request and master push.
  6. # Publication is a manual dispatch from a vendor-* tag; a vendor release can
  7. # carry several versions, so each package has its own tag.
  8. name: Release (vendor)
  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 vendor-* tag.
  17. required: true
  18. type: boolean
  19. default: false
  20. permissions:
  21. contents: read
  22. concurrency:
  23. # Pack runs per ref so concurrent pull requests never displace each
  24. # other; the publish job below serializes the shared dist-tag state.
  25. group: ${{ github.workflow }}-${{ github.ref }}
  26. cancel-in-progress: false
  27. env:
  28. PRIMARY_NODE_VERSION: '24'
  29. DSH_TELEMETRY_DISABLED: '1'
  30. jobs:
  31. pack:
  32. name: Pack npm tarballs
  33. runs-on: ubuntu-24.04
  34. steps:
  35. # Complete history: the release scripts read tags.
  36. - uses: actions/checkout@v6
  37. with:
  38. fetch-depth: 0
  39. persist-credentials: false
  40. - uses: pnpm/action-setup@v4
  41. with:
  42. dest: ${{ runner.temp }}/setup-pnpm
  43. - uses: actions/setup-node@v6
  44. with:
  45. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  46. - name: Configure pnpm store path
  47. id: pnpm-store
  48. run: |
  49. store_root="$HOME/.local/share/pnpm/store"
  50. echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV"
  51. store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent)
  52. echo "path=$store_path" >> "$GITHUB_OUTPUT"
  53. - uses: actions/cache/restore@v4
  54. with:
  55. path: ${{ steps.pnpm-store.outputs.path }}
  56. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  57. restore-keys: |
  58. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  59. - name: Install (immutable)
  60. run: pnpm install --frozen-lockfile
  61. - name: Verify release version
  62. env:
  63. RELEASE_PUBLISH: ${{ inputs.publish }}
  64. run: pnpm run release:verify --family vendor
  65. # The vendored packages publish their own sources and build outputs; the
  66. # host build produces what their manifests select.
  67. - name: Build
  68. run: pnpm run build:lib:host
  69. - name: Pack release tarballs
  70. run: pnpm run release:pack --family vendor --out dist/npm-vendor
  71. - name: Verify packed install
  72. run: pnpm run release:verify-packed-install --family vendor --from dist/npm-vendor
  73. - uses: actions/upload-artifact@v4
  74. with:
  75. name: vendor-npm-tarballs
  76. path: dist/npm-vendor/*
  77. if-no-files-found: error
  78. retention-days: 7
  79. publish:
  80. name: Publish to npm
  81. if: inputs.publish
  82. needs: pack
  83. runs-on: ubuntu-24.04
  84. environment: npm-publish
  85. concurrency:
  86. group: Release-publish
  87. cancel-in-progress: false
  88. permissions:
  89. contents: read
  90. steps:
  91. # Checkout and install carry the release scripts only; no build step.
  92. - uses: actions/checkout@v6
  93. with:
  94. persist-credentials: false
  95. - uses: pnpm/action-setup@v4
  96. with:
  97. dest: ${{ runner.temp }}/setup-pnpm
  98. - uses: actions/setup-node@v6
  99. with:
  100. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  101. registry-url: https://registry.npmjs.org
  102. - name: Install (immutable, no package scripts)
  103. run: pnpm install --frozen-lockfile --ignore-scripts
  104. - uses: actions/download-artifact@v4
  105. with:
  106. name: vendor-npm-tarballs
  107. path: dist/npm-vendor
  108. - name: Publish tarballs
  109. env:
  110. NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
  111. run: pnpm run release:publish --family vendor --from dist/npm-vendor