|
6 | 6 | - next
|
7 | 7 |
|
8 | 8 | jobs:
|
9 |
| - create_release: |
| 9 | + release_to_npm: |
10 | 10 | permissions:
|
11 | 11 | contents: write
|
12 | 12 | runs-on: ubuntu-latest
|
13 |
| - outputs: |
14 |
| - is_latest: ${{ steps.release_type.outputs.is_latest }} |
15 |
| - is_new_version: ${{ steps.version_check.outputs.is_new_version }} |
16 | 13 |
|
17 | 14 | steps:
|
18 | 15 | - name: Checkout 🛎️
|
|
21 | 18 | fetch-depth: 20
|
22 | 19 | fetch-tags: false
|
23 | 20 |
|
| 21 | + - name: Setup Node version ⚙️ |
| 22 | + uses: actions/setup-node@v4 |
| 23 | + with: |
| 24 | + node-version: 20 |
| 25 | + registry-url: https://registry.npmjs.org/ |
| 26 | + |
| 27 | + - id: cache-yarn |
| 28 | + name: Restore cached node modules ♻️ |
| 29 | + uses: actions/cache@v4 |
| 30 | + with: |
| 31 | + path: | |
| 32 | + .yarn/cache |
| 33 | + node_modules |
| 34 | + key: ${{ inputs.os }}-${{ inputs.node }}-release-${{ hashFiles('**/yarn.lock') }} |
| 35 | + restore-keys: | |
| 36 | + ${{ inputs.os }}-${{ inputs.node }}-release |
| 37 | +
|
24 | 38 | - id: version_check
|
25 | 39 | name: Verify new version 🔍
|
26 | 40 | run: |
|
@@ -64,50 +78,22 @@ jobs:
|
64 | 78 | draft: false
|
65 | 79 | prerelease: ${{ steps.release_type.outputs.is_latest != 'true' }}
|
66 | 80 |
|
67 |
| - publish_to_npm: |
68 |
| - needs: create_release |
69 |
| - if: ${{ needs.create_release.outputs.is_new_version == 'true' }} |
70 |
| - runs-on: ubuntu-latest |
71 |
| - |
72 |
| - steps: |
73 |
| - - name: Checkout 🛎️ |
74 |
| - uses: actions/checkout@v4 |
75 |
| - with: |
76 |
| - fetch-depth: 20 |
77 |
| - fetch-tags: false |
78 |
| - |
79 |
| - - id: cache-yarn |
80 |
| - name: Restore cached node modules ♻️ |
81 |
| - uses: actions/cache@v4 |
82 |
| - with: |
83 |
| - path: | |
84 |
| - .yarn/cache |
85 |
| - node_modules |
86 |
| - key: ${{ inputs.os }}-${{ inputs.node }}-release-${{ hashFiles('**/yarn.lock') }} |
87 |
| - restore-keys: | |
88 |
| - ${{ inputs.os }}-${{ inputs.node }}-release |
89 |
| -
|
90 |
| - - name: Setup Node version ⚙️ |
91 |
| - uses: actions/setup-node@v4 |
92 |
| - with: |
93 |
| - node-version: 20 |
94 |
| - registry-url: https://registry.npmjs.org/ |
95 |
| - |
96 | 81 | - name: Install 🔧
|
97 |
| - if: ${{ steps.cache-yarn.outputs.cache-hit != 'true' }} |
| 82 | + if: ${{ steps.version_check.outputs.is_new_version == 'true' }} |
98 | 83 | run: yarn --immutable
|
99 | 84 |
|
100 | 85 | - name: Build 🔨
|
| 86 | + if: ${{ steps.version_check.outputs.is_new_version == 'true' }} |
101 | 87 | run: yarn build
|
102 | 88 |
|
103 | 89 | - name: Publish with latest tag 🚀
|
104 |
| - if: ${{ needs.create_release.outputs.is_latest == 'true' }} |
| 90 | + if: ${{ steps.version_check.outputs.is_new_version == 'true' && steps.release_type.outputs.is_latest == 'true' }} |
105 | 91 | run: npm publish --access public
|
106 | 92 | env:
|
107 | 93 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
108 | 94 |
|
109 | 95 | - name: Publish with next tag 🚀
|
110 |
| - if: ${{ needs.create_release.outputs.is_latest != 'true' }} |
| 96 | + if: ${{ steps.version_check.outputs.is_new_version == 'true' && steps.release_type.outputs.is_latest != 'true' }} |
111 | 97 | run: npm publish --access public --tag next
|
112 | 98 | env:
|
113 | 99 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
0 commit comments