release-subpackages.yml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. name: Release Subpackages
  2. on:
  3. push:
  4. branches:
  5. - master
  6. paths:
  7. - .changeset/**
  8. - .github/workflows/release-subpackages.yml
  9. workflow_run:
  10. workflows: ["Node CI for app development"]
  11. types:
  12. - completed
  13. branches:
  14. - master
  15. concurrency:
  16. group: ${{ github.workflow }}-${{ github.ref }}
  17. cancel-in-progress: true
  18. jobs:
  19. release-subpackages-snapshot:
  20. if: "!startsWith(github.head_ref, 'changeset-release/')"
  21. runs-on: ubuntu-latest
  22. steps:
  23. - uses: actions/checkout@v4
  24. - uses: actions/setup-node@v4
  25. with:
  26. node-version: '20'
  27. cache: 'yarn'
  28. cache-dependency-path: '**/yarn.lock'
  29. - name: Cache/Restore node_modules
  30. id: cache-dependencies
  31. uses: actions/cache@v4
  32. with:
  33. path: |
  34. **/node_modules
  35. key: node_modules-release-subpackages-${{ runner.OS }}-node${{ inputs.node-version }}-${{ hashFiles('**/yarn.lock') }}
  36. restore-keys: |
  37. node_modules-release-subpackages-${{ runner.OS }}-node${{ inputs.node-version }}-
  38. - name: Install dependencies
  39. run: |
  40. yarn global add turbo
  41. yarn global add node-gyp
  42. yarn --frozen-lockfile
  43. - name: Setup .npmrc
  44. run: |
  45. cat << EOF > "$HOME/.npmrc"
  46. //registry.npmjs.org/:_authToken=$NPM_TOKEN
  47. EOF
  48. env:
  49. NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
  50. - name: Snapshot release to npm
  51. run: |
  52. yarn release-subpackages:snapshot
  53. env:
  54. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  55. NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
  56. release-subpackages:
  57. runs-on: ubuntu-latest
  58. steps:
  59. - uses: actions/checkout@v4
  60. - uses: actions/setup-node@v4
  61. with:
  62. node-version: '20'
  63. cache: 'yarn'
  64. cache-dependency-path: '**/yarn.lock'
  65. - name: Cache/Restore node_modules
  66. id: cache-dependencies
  67. uses: actions/cache@v4
  68. with:
  69. path: |
  70. **/node_modules
  71. key: node_modules-release-subpackages-${{ runner.OS }}-node${{ inputs.node-version }}-${{ hashFiles('**/yarn.lock') }}
  72. restore-keys: |
  73. node_modules-release-subpackages-${{ runner.OS }}-node${{ inputs.node-version }}-
  74. - name: Install dependencies
  75. run: |
  76. yarn global add turbo
  77. yarn global add node-gyp
  78. yarn --frozen-lockfile
  79. - name: Create Release Pull Request or Publish to npm
  80. id: changesets
  81. uses: changesets/action@v1
  82. with:
  83. title: Release Subpackages
  84. publish: yarn release-subpackages
  85. env:
  86. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  87. NPM_TOKEN: ${{ secrets.NPM_TOKEN }}