|
1 | | -name: "Publish to npm" |
| 1 | +name: "Publish package" |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | release: |
|
14 | 14 | SLACK_DEPLOY_ERROR_REACTION: ${{ vars.SLACK_DEPLOY_ERROR_REACTION_PRODUCTION }} |
15 | 15 |
|
16 | 16 | jobs: |
17 | | - publish: |
| 17 | + start: |
18 | 18 | runs-on: ubuntu-latest |
| 19 | + outputs: |
| 20 | + thread_ts: ${{ steps.slack.outputs.ts }} |
| 21 | + version: ${{ steps.version.outputs.value }} |
19 | 22 | steps: |
20 | 23 | - name: Post to Slack |
21 | 24 | uses: Fieldguide/action-slack-deploy-pipeline@v2 |
22 | 25 | id: slack |
23 | 26 |
|
24 | | - - name: Checkout code |
25 | | - uses: actions/checkout@v4 |
26 | | - |
27 | 27 | - name: Parse version |
28 | 28 | id: version |
29 | 29 | run: echo "value=${GITHUB_REF#refs/*/v}" >> $GITHUB_OUTPUT |
30 | 30 |
|
| 31 | + publish-npm: |
| 32 | + needs: start |
| 33 | + runs-on: ubuntu-latest |
| 34 | + steps: |
| 35 | + - name: Checkout code |
| 36 | + uses: actions/checkout@v4 |
| 37 | + |
31 | 38 | - name: Update npm package version for build / publishing |
32 | | - run: npm version ${{ steps.version.outputs.value }} --no-git-tag-version |
| 39 | + run: npm version ${{ needs.start.outputs.version }} --no-git-tag-version |
33 | 40 |
|
34 | 41 | - name: Setup Node.js |
35 | 42 | uses: actions/setup-node@v4 |
|
47 | 54 | env: |
48 | 55 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
49 | 56 |
|
| 57 | + publish-github: |
| 58 | + needs: start |
| 59 | + runs-on: ubuntu-latest |
| 60 | + permissions: |
| 61 | + packages: write |
| 62 | + steps: |
| 63 | + - name: Checkout code |
| 64 | + uses: actions/checkout@v4 |
| 65 | + |
| 66 | + - name: Update npm package version for build / publishing |
| 67 | + run: npm version ${{ needs.start.outputs.version }} --no-git-tag-version |
| 68 | + |
| 69 | + - name: Setup Node.js |
| 70 | + uses: actions/setup-node@v4 |
| 71 | + with: |
| 72 | + node-version-file: ".nvmrc" |
| 73 | + cache: "npm" |
| 74 | + registry-url: "https://npm.pkg.github.com" |
| 75 | + |
| 76 | + - name: Install dependencies |
| 77 | + run: npm ci --prefer-offline --no-audit |
| 78 | + |
| 79 | + - name: Publish package |
| 80 | + run: npm publish --access public |
| 81 | + env: |
| 82 | + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 83 | + |
| 84 | + finish: |
| 85 | + needs: |
| 86 | + - start |
| 87 | + - publish-npm |
| 88 | + - publish-github |
| 89 | + runs-on: ubuntu-latest |
| 90 | + steps: |
50 | 91 | - name: "Post to Slack" |
51 | 92 | uses: Fieldguide/action-slack-deploy-pipeline@v2 |
52 | 93 | if: always() |
53 | 94 | with: |
54 | | - thread_ts: ${{ steps.slack.outputs.ts }} |
| 95 | + thread_ts: ${{ needs.start.outputs.thread_ts }} |
55 | 96 | conclusion: true |
0 commit comments