release-subpackages.yml 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. runs-on: ubuntu-latest
  21. steps:
  22. - uses: actions/checkout@v4
  23. - uses: actions/setup-node@v4
  24. with:
  25. node-version: '20'
  26. cache: 'yarn'
  27. cache-dependency-path: '**/yarn.lock'
  28. - name: Cache/Restore node_modules
  29. id: cache-dependencies
  30. uses: actions/cache@v4
  31. with:
  32. path: |
  33. **/node_modules
  34. key: node_modules-release-subpackages-${{ runner.OS }}-node${{ inputs.node-version }}-${{ hashFiles('**/yarn.lock') }}
  35. restore-keys: |
  36. node_modules-release-subpackages-${{ runner.OS }}-node${{ inputs.node-version }}-
  37. - name: Install dependencies
  38. run: |
  39. yarn global add turbo
  40. yarn global add node-gyp
  41. yarn --frozen-lockfile
  42. - name: Setup .npmrc
  43. run: |
  44. cat << EOF > "$HOME/.npmrc"
  45. //registry.npmjs.org/:_authToken=$NPM_TOKEN
  46. EOF
  47. env:
  48. NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
  49. - name: Snapshot release to npm
  50. run: |
  51. yarn release-subpackages:snapshot
  52. env:
  53. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  54. NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
  55. release-subpackages:
  56. runs-on: ubuntu-latest
  57. steps:
  58. - uses: actions/checkout@v4
  59. - uses: actions/setup-node@v4
  60. with:
  61. node-version: '20'
  62. cache: 'yarn'
  63. cache-dependency-path: '**/yarn.lock'
  64. - name: Cache/Restore node_modules
  65. id: cache-dependencies
  66. uses: actions/cache@v4
  67. with:
  68. path: |
  69. **/node_modules
  70. key: node_modules-release-subpackages-${{ runner.OS }}-node${{ inputs.node-version }}-${{ hashFiles('**/yarn.lock') }}
  71. restore-keys: |
  72. node_modules-release-subpackages-${{ runner.OS }}-node${{ inputs.node-version }}-
  73. - name: Install dependencies
  74. run: |
  75. yarn global add turbo
  76. yarn global add node-gyp
  77. yarn --frozen-lockfile
  78. - name: Create Release Pull Request or Publish to npm
  79. id: changesets
  80. uses: changesets/action@v1
  81. with:
  82. publish: yarn release-subpackages
  83. env:
  84. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  85. NPM_TOKEN: ${{ secrets.NPM_TOKEN }}