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 | 14 | |
4c156521 JB |
15 | - name: Setup pnpm |
16 | uses: pnpm/action-setup@v2 | |
17 | with: | |
18 | version: 8 | |
19 | ||
8ea47589 | 20 | - name: Setup Node.js |
b8497a0a | 21 | uses: actions/setup-node@v3 |
11caf266 | 22 | with: |
02234757 | 23 | node-version: '18.x' |
4c156521 | 24 | cache: 'pnpm' |
e0d233a8 JB |
25 | |
26 | - name: Install | |
4c156521 | 27 | run: pnpm install |
e0d233a8 | 28 | |
4b85ba43 JB |
29 | - name: Tests & Coverage |
30 | run: | | |
4c156521 JB |
31 | pnpm test |
32 | pnpm coverage | |
11caf266 | 33 | |
73db65c0 | 34 | - name: Lint |
4c156521 | 35 | run: pnpm lint |
73db65c0 | 36 | |
4b85ba43 | 37 | - name: Production Build |
4c156521 | 38 | run: pnpm build:prod |
4b85ba43 | 39 | |
186b35b6 | 40 | publish: |
90bd5e47 | 41 | needs: build |
42 | runs-on: ubuntu-latest | |
43 | ||
44 | steps: | |
45 | - name: Checkout | |
b8497a0a | 46 | uses: actions/checkout@v3 |
90bd5e47 | 47 | |
4c156521 JB |
48 | - name: Setup pnpm |
49 | uses: pnpm/action-setup@v2 | |
50 | with: | |
51 | version: 8 | |
52 | ||
8ea47589 | 53 | - name: Setup Node.js |
b8497a0a | 54 | uses: actions/setup-node@v3 |
11caf266 | 55 | with: |
02234757 | 56 | node-version: '18.x' |
11caf266 | 57 | registry-url: https://registry.npmjs.org/ |
4c156521 | 58 | cache: 'pnpm' |
515e5da7 | 59 | |
5716dd56 | 60 | - name: Read package.json version |
5716dd56 | 61 | id: package-version |
8fddc4b9 | 62 | uses: jaywcjlove/github-action-package@main |
5716dd56 | 63 | |
515e5da7 | 64 | - name: Install |
4c156521 | 65 | run: pnpm install |
90bd5e47 | 66 | |
5716dd56 S |
67 | - name: Publish Release |
68 | if: ${{ contains(steps.package-version.outputs.version, '-') == false }} | |
a454d573 | 69 | run: pnpm publish --no-git-checks |
11caf266 | 70 | env: |
74aeaae0 | 71 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
5716dd56 | 72 | |
17c90274 | 73 | - name: Publish Pre-Release |
04805b54 | 74 | if: ${{ contains(steps.package-version.outputs.version, '-') == true && contains(steps.package-version.outputs.version, '-beta') == false }} |
a454d573 | 75 | run: pnpm publish --no-git-checks --tag next |
5716dd56 | 76 | env: |
74aeaae0 | 77 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
17c90274 | 78 | |
8ea47589 JB |
79 | - name: Publish Beta Release |
80 | if: ${{ contains(steps.package-version.outputs.version, '-beta') == true }} | |
81 | run: pnpm publish --no-git-checks --tag beta | |
82 | env: | |
83 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |