|
7 | 7 | push:
|
8 | 8 | branches:
|
9 | 9 | - master
|
10 |
| - tags: |
11 |
| - - 'v*.*.*' |
| 10 | + release: |
| 11 | + types: [published] |
12 | 12 |
|
13 | 13 | jobs:
|
14 | 14 | test:
|
15 | 15 | name: "test-node-${{ matrix.node-version }}"
|
16 | 16 | runs-on: ubuntu-latest
|
17 | 17 | strategy:
|
| 18 | + fail-fast: false |
18 | 19 | matrix:
|
19 | 20 | node-version: [14, 16, 18, 20]
|
20 | 21 | steps:
|
|
25 | 26 | uses: actions/setup-node@v4
|
26 | 27 | with:
|
27 | 28 | node-version: ${{ matrix.node-version }}
|
28 |
| - cache: 'yarn' |
29 | 29 |
|
30 | 30 | - name: Install dependencies
|
31 | 31 | run: yarn install --frozen-lockfile
|
|
47 | 47 | uses: test-summary/action@v2
|
48 | 48 | with:
|
49 | 49 | paths: ./test-reports/jest/results.xml
|
| 50 | + |
| 51 | + lint: |
| 52 | + name: "lint" |
| 53 | + runs-on: ubuntu-latest |
| 54 | + steps: |
| 55 | + - name: Checkout |
| 56 | + uses: actions/checkout@v4 |
| 57 | + |
| 58 | + - name: Setup NodeJS |
| 59 | + uses: actions/setup-node@v4 |
| 60 | + with: |
| 61 | + node-version-file: .nvmrc |
| 62 | + cache: 'yarn' |
| 63 | + |
| 64 | + - name: Install dependencies |
| 65 | + run: yarn install --frozen-lockfile |
| 66 | + |
| 67 | + - name: Run prettier |
| 68 | + run: yarn lint:check |
| 69 | + |
| 70 | + build: |
| 71 | + runs-on: ubuntu-latest |
| 72 | + steps: |
| 73 | + - name: Checkout |
| 74 | + uses: actions/checkout@v4 |
| 75 | + |
| 76 | + - name: Setup NodeJS |
| 77 | + uses: actions/setup-node@v4 |
| 78 | + with: |
| 79 | + node-version-file: .nvmrc |
| 80 | + cache: 'yarn' |
| 81 | + |
| 82 | + - name: Install dependencies |
| 83 | + run: yarn install --frozen-lockfile |
| 84 | + |
| 85 | + - run: yarn build |
| 86 | + - run: npm link |
| 87 | + - run: npx proxay --help |
| 88 | + - run: | |
| 89 | + npx proxay -m record -h https://www.google.com -t tapes/ & |
| 90 | + # Wait until it loads. |
| 91 | + until (curl http://localhost:3000 2>&1 | grep Google &>/dev/null) |
| 92 | + do |
| 93 | + echo "Waiting until server ready..." |
| 94 | + sleep 5 |
| 95 | + done |
| 96 | +
|
| 97 | + publish: |
| 98 | + runs-on: ubuntu-latest |
| 99 | + if: github.event_name == 'release' |
| 100 | + needs: |
| 101 | + - test |
| 102 | + - build |
| 103 | + - lint |
| 104 | + env: |
| 105 | + # Used in setup-node and publish steps |
| 106 | + NODE_AUTH_TOKEN: ${{ secrets.NPMJS_PUBLISH_TOKEN }} |
| 107 | + steps: |
| 108 | + - name: Checkout |
| 109 | + uses: actions/checkout@v4 |
| 110 | + |
| 111 | + - name: Setup NodeJS |
| 112 | + uses: actions/setup-node@v4 |
| 113 | + with: |
| 114 | + node-version-file: .nvmrc |
| 115 | + cache: 'yarn' |
| 116 | + registry-url: 'https://registry.npmjs.org' |
| 117 | + |
| 118 | + - name: Install dependencies |
| 119 | + run: yarn install --frozen-lockfile |
| 120 | + |
| 121 | + - run: yarn build |
| 122 | + |
| 123 | + - name: Publish to npm registry |
| 124 | + run: npm publish --provenance --access public |
0 commit comments