|
1 |
| -# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created |
2 |
| -# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages |
3 |
| - |
4 |
| -name: Node.js Package publish |
5 |
| - |
6 |
| -on: |
7 |
| - push: |
8 |
| - branches: |
9 |
| - - 'master' |
10 |
| - - 'next' |
11 |
| - |
12 |
| - workflow_dispatch: |
13 |
| - inputs: |
14 |
| - logLevel: |
15 |
| - description: 'Log level' |
16 |
| - required: true |
17 |
| - default: 'warning' |
18 |
| - tags: |
19 |
| - description: 'Testing node.js package publish workflow' |
20 |
| - |
21 |
| -jobs: |
22 |
| - build: |
23 |
| - runs-on: ubuntu-latest |
24 |
| - steps: |
25 |
| - - uses: actions/checkout@v3 |
26 |
| - - uses: actions/setup-node@v3 |
27 |
| - with: |
28 |
| - node-version: 16 |
29 |
| - - run: npm ci |
30 |
| - - run: npm test |
31 |
| - |
32 |
| - publish-gpr: |
33 |
| - needs: build |
34 |
| - runs-on: ubuntu-latest |
35 |
| - permissions: |
36 |
| - contents: read |
37 |
| - packages: write |
38 |
| - steps: |
39 |
| - - name: Checkout code |
40 |
| - uses: actions/checkout@v2 |
41 |
| - |
42 |
| - - uses: actions/setup-node@v2 |
43 |
| - with: |
44 |
| - node-version: 16 |
45 |
| - registry-url: https://npm.pkg.github.com/ |
46 |
| - - run: npm ci |
47 |
| - |
48 |
| - - name: Check if version has been updated |
49 |
| - id: check |
50 |
| - uses: EndBug/version-check@v2 |
51 |
| - with: |
52 |
| - diff-search: true |
53 |
| - - name: Log when changed |
54 |
| - if: steps.check.outputs.changed == 'true' |
55 |
| - run: 'echo "Version change found in commit ${{ steps.check.outputs.commit }}! New version: ${{ steps.check.outputs.version }} (${{ steps.check.outputs.type }})"' |
56 |
| - - name: Log when unchanged |
57 |
| - if: steps.check.outputs.changed == 'false' |
58 |
| - run: 'echo "No version change :/"' |
59 |
| - |
60 |
| - - run: npm publish --tag stable |
61 |
| - if: ${{ steps.check.outputs.changed == 'true' && github.ref == 'refs/heads/master' }} |
62 |
| - env: |
63 |
| - NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
64 |
| - - run: npm publish --tag next |
65 |
| - if: ${{ steps.check.outputs.changed == 'true' && github.ref == 'refs/heads/next' }} |
66 |
| - env: |
67 |
| - NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
68 |
| - - run: npm dist-tag add @fails-components/security@${{ steps.check.outputs.version }} latest |
69 |
| - if: ${{ steps.check.outputs.changed == 'true' && github.ref == 'refs/heads/master' }} |
70 |
| - env: |
71 |
| - NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
72 |
| - - run: npm dist-tag add @fails-components/security@${{ steps.check.outputs.version }} latestunstable |
73 |
| - if: ${{ steps.check.outputs.changed == 'true' && github.ref == 'refs/heads/next' }} |
74 |
| - env: |
75 |
| - NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 1 | +# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created |
| 2 | +# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages |
| 3 | + |
| 4 | +name: Node.js Package publish |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + branches: |
| 9 | + - 'master' |
| 10 | + - 'next' |
| 11 | + |
| 12 | + workflow_dispatch: |
| 13 | + inputs: |
| 14 | + logLevel: |
| 15 | + description: 'Log level' |
| 16 | + required: true |
| 17 | + default: 'warning' |
| 18 | + tags: |
| 19 | + description: 'Testing node.js package publish workflow' |
| 20 | + |
| 21 | +jobs: |
| 22 | + build: |
| 23 | + runs-on: ubuntu-latest |
| 24 | + steps: |
| 25 | + - uses: actions/checkout@v3 |
| 26 | + - uses: actions/setup-node@v3 |
| 27 | + with: |
| 28 | + node-version: 20 |
| 29 | + - run: npm ci |
| 30 | + - run: npm test |
| 31 | + |
| 32 | + publish-gpr: |
| 33 | + needs: build |
| 34 | + runs-on: ubuntu-latest |
| 35 | + permissions: |
| 36 | + contents: read |
| 37 | + packages: write |
| 38 | + steps: |
| 39 | + - name: Checkout code |
| 40 | + uses: actions/checkout@v2 |
| 41 | + |
| 42 | + - uses: actions/setup-node@v2 |
| 43 | + with: |
| 44 | + node-version: 20 |
| 45 | + registry-url: https://npm.pkg.github.com/ |
| 46 | + - run: npm ci |
| 47 | + |
| 48 | + - name: Check if version has been updated |
| 49 | + id: check |
| 50 | + uses: EndBug/version-check@v2 |
| 51 | + with: |
| 52 | + diff-search: true |
| 53 | + - name: Log when changed |
| 54 | + if: steps.check.outputs.changed == 'true' |
| 55 | + run: 'echo "Version change found in commit ${{ steps.check.outputs.commit }}! New version: ${{ steps.check.outputs.version }} (${{ steps.check.outputs.type }})"' |
| 56 | + - name: Log when unchanged |
| 57 | + if: steps.check.outputs.changed == 'false' |
| 58 | + run: 'echo "No version change :/"' |
| 59 | + |
| 60 | + - run: npm publish --tag stable |
| 61 | + if: ${{ steps.check.outputs.changed == 'true' && github.ref == 'refs/heads/master' }} |
| 62 | + env: |
| 63 | + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 64 | + - run: npm publish --tag next |
| 65 | + if: ${{ steps.check.outputs.changed == 'true' && github.ref == 'refs/heads/next' }} |
| 66 | + env: |
| 67 | + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 68 | + - run: npm dist-tag add @fails-components/security@${{ steps.check.outputs.version }} latest |
| 69 | + if: ${{ steps.check.outputs.changed == 'true' && github.ref == 'refs/heads/master' }} |
| 70 | + env: |
| 71 | + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 72 | + - run: npm dist-tag add @fails-components/security@${{ steps.check.outputs.version }} latestunstable |
| 73 | + if: ${{ steps.check.outputs.changed == 'true' && github.ref == 'refs/heads/next' }} |
| 74 | + env: |
| 75 | + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments