Commit | Line | Data |
---|---|---|
11caf266 APA |
1 | name: Node.js Package |
2 | ||
3 | on: | |
4 | release: | |
5 | types: [created] | |
6 | ||
7 | jobs: | |
8 | build: | |
9 | runs-on: ubuntu-latest | |
515e5da7 | 10 | |
11caf266 | 11 | steps: |
515e5da7 | 12 | - name: Checkout |
b8497a0a | 13 | uses: actions/checkout@v3 |
515e5da7 APA |
14 | |
15 | - name: Setup Node | |
b8497a0a | 16 | uses: actions/setup-node@v3 |
11caf266 | 17 | with: |
02234757 | 18 | node-version: '18.x' |
e0d233a8 JB |
19 | |
20 | - name: Install | |
21 | run: npm ci | |
22 | ||
4b85ba43 JB |
23 | - name: Tests & Coverage |
24 | run: | | |
25 | npm run test | |
26 | npm run coverage | |
11caf266 | 27 | |
73db65c0 JB |
28 | - name: Lint |
29 | run: npm run lint | |
30 | ||
4b85ba43 JB |
31 | - name: Production Build |
32 | run: npm run build:prod | |
33 | ||
90bd5e47 | 34 | publish-npm: |
35 | needs: build | |
36 | runs-on: ubuntu-latest | |
37 | ||
38 | steps: | |
39 | - name: Checkout | |
b8497a0a | 40 | uses: actions/checkout@v3 |
90bd5e47 | 41 | |
515e5da7 | 42 | - name: Setup Node |
b8497a0a | 43 | uses: actions/setup-node@v3 |
11caf266 | 44 | with: |
02234757 | 45 | node-version: '18.x' |
11caf266 | 46 | registry-url: https://registry.npmjs.org/ |
515e5da7 | 47 | |
5716dd56 | 48 | - name: Read package.json version |
5716dd56 | 49 | id: package-version |
8fddc4b9 | 50 | uses: jaywcjlove/github-action-package@main |
5716dd56 | 51 | |
515e5da7 | 52 | - name: Install |
90bd5e47 | 53 | run: npm ci |
54 | ||
5716dd56 S |
55 | - name: Publish Release |
56 | if: ${{ contains(steps.package-version.outputs.version, '-') == false }} | |
4f4ae1cb | 57 | run: npm publish |
11caf266 | 58 | env: |
74aeaae0 | 59 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
5716dd56 S |
60 | |
61 | - name: Publish Beta | |
62 | if: ${{ contains(steps.package-version.outputs.version, 'beta') }} | |
63 | run: npm publish --tag beta | |
64 | env: | |
74aeaae0 | 65 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |