|
11 | 11 |
|
12 | 12 | jobs: |
13 | 13 | test: |
14 | | - runs-on: macos-latest-large |
15 | | - |
| 14 | + runs-on: ubuntu-latest |
| 15 | + environment: npm-publish |
| 16 | + permissions: |
| 17 | + contents: read |
| 18 | + id-token: write |
16 | 19 | steps: |
17 | 20 | - name: setup repo |
18 | 21 | uses: actions/checkout@v4 |
|
41 | 44 | run: npm pack |
42 | 45 | working-directory: packages/${{ github.event.inputs.package }} |
43 | 46 |
|
44 | | - - name: upload artifact |
45 | | - uses: actions/upload-artifact@v4 |
46 | | - with: |
47 | | - name: ${{ github.event.inputs.package }} |
48 | | - path: packages/${{ github.event.inputs.package }}/*.tgz |
49 | | - |
50 | | - publish: |
51 | | - runs-on: macos-latest-large |
52 | | - needs: test |
53 | | - environment: npm-publish |
54 | | - permissions: |
55 | | - contents: read |
56 | | - id-token: write |
57 | | - steps: |
58 | | - |
59 | | - - name: download artifact |
60 | | - uses: actions/download-artifact@v4 |
| 47 | + - uses: JS-DevTools/npm-publish@v3 |
61 | 48 | with: |
62 | | - name: ${{ github.event.inputs.package }} |
63 | | - |
64 | | - - name: setup authentication |
65 | | - run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> .npmrc |
66 | | - env: |
67 | | - NPM_TOKEN: ${{ secrets.TOKEN }} |
68 | | - |
69 | | - - name: publish |
70 | | - run: npm publish --provenance *.tgz |
71 | | - |
72 | | - - name: notify slack on failure |
73 | | - if: failure() |
74 | | - run: | |
75 | | - curl -X POST -H 'Content-type: application/json' --data '{"text":":pb__failed: Failed to publish a new version of ${{ github.event.inputs.package }}"}' $SLACK_WEBHOOK |
76 | | - env: |
77 | | - SLACK_WEBHOOK: ${{ secrets.SLACK }} |
78 | | - |
79 | | - - name: notify slack on success |
80 | | - if: success() |
81 | | - run: | |
82 | | - curl -X POST -H 'Content-type: application/json' --data '{"text":":dance: Successfully published a new version of ${{ github.event.inputs.package }}"}' $SLACK_WEBHOOK |
83 | | - env: |
84 | | - SLACK_WEBHOOK: ${{ secrets.SLACK }} |
85 | | - |
| 49 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 50 | + registry: "https://npm.pkg.github.com" |
0 commit comments