|
1 | 1 | # This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
|
2 | 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
3 |
| - |
4 |
| -name: Publish |
| 3 | +name: Publish npm Package |
5 | 4 |
|
6 | 5 | on:
|
7 |
| - release: |
8 |
| - types: [published] |
9 |
| -jobs: |
10 |
| - publish: |
| 6 | + push: |
| 7 | + branches: |
| 8 | + - master |
11 | 9 |
|
| 10 | +jobs: |
| 11 | + publish-npm: |
12 | 12 | runs-on: ubuntu-latest
|
13 |
| - |
14 | 13 | steps:
|
15 |
| - - uses: actions/checkout@v3 |
16 |
| - with: |
17 |
| - ref: ${{ github.event.release.target_commitish }} |
18 |
| - - uses: actions/setup-node@v3 |
19 |
| - with: |
20 |
| - node-version: 20 |
21 |
| - cache: 'npm' |
22 |
| - - run: git config --global user.name "GitHub CD bot" |
23 |
| - - run: git config --global user.email "[email protected]" |
24 |
| - - run: npm version ${{ github.event.release.tag_name }} |
25 |
| - - run: npm i |
26 |
| - - run: export NODE_OPTIONS=--openssl-legacy-provider && npm run build |
27 |
| - - uses: JS-DevTools/npm-publish@v1 |
28 |
| - with: |
29 |
| - token: ${{ secrets.NPM_TOKEN }} |
30 |
| - |
31 |
| - # push the version changes to GitHub |
32 |
| - - run: git push |
33 |
| - env: |
34 |
| - # The secret is passed automatically. Nothing to configure. |
35 |
| - github-token: ${{ secrets.GITHUB_TOKEN }} |
| 14 | + - uses: actions/checkout@v3 |
| 15 | + - uses: actions/setup-node@v3 |
| 16 | + with: |
| 17 | + node-version: 20 |
| 18 | + registry-url: https://registry.npmjs.org/ |
| 19 | + - run: git config --global user.name "GitHub CD bot" |
| 20 | + - run: git config --global user.email "[email protected]" |
| 21 | + - name: Install deps |
| 22 | + run: npm i |
| 23 | + - name: Build the app |
| 24 | + run: export NODE_OPTIONS=--openssl-legacy-provider && npm run build |
| 25 | + - run: npx semantic-release |
| 26 | + env: |
| 27 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 28 | + # push the version changes to GitHub |
| 29 | + - run: git push |
| 30 | + env: |
| 31 | + # The secret is passed automatically. Nothing to configure. |
| 32 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments