|
2 | 2 | # request. This PR is opened when we have a new commit to main. |
3 | 3 | # See: |
4 | 4 | # https://github.com/googleapis/release-please |
5 | | -name: Release Please |
| 5 | +name: CI main |
6 | 6 | on: |
7 | 7 | push: |
8 | 8 | branches: |
9 | 9 | - main |
10 | 10 | jobs: |
11 | | - release-please: |
12 | | - runs-on: ubuntu-20.04 |
| 11 | + test: |
| 12 | + runs-on: ubuntu-latest |
13 | 13 |
|
14 | 14 | strategy: |
15 | 15 | matrix: |
16 | 16 | node-version: [12.x, 14.x, 16.x, 18.x] |
17 | 17 |
|
| 18 | + steps: |
| 19 | + - name: Checkout |
| 20 | + uses: actions/checkout@v3 |
| 21 | + |
| 22 | + - name: Setup Node ${{ matrix.node-version }} |
| 23 | + uses: actions/setup-node@v3 |
| 24 | + with: |
| 25 | + node-version: ${{ matrix.node-version }} |
| 26 | + |
| 27 | + - name: Install dependencies |
| 28 | + run: npm ci |
| 29 | + |
| 30 | + - name: Lint |
| 31 | + run: npm run lint |
| 32 | + |
| 33 | + - name: Test |
| 34 | + run: npm test |
| 35 | + |
| 36 | + - name: Report coverage |
| 37 | + run: npm run report-coverage |
| 38 | + |
| 39 | + - name: Store coverage artifacts |
| 40 | + uses: actions/upload-artifact@v3 |
| 41 | + with: |
| 42 | + name: build-artifacts |
| 43 | + path: | |
| 44 | + ./artifacts/**/*.* |
| 45 | +
|
| 46 | + release-please: |
| 47 | + runs-on: ubuntu-latest |
| 48 | + needs: 'test' |
| 49 | + |
18 | 50 | steps: |
19 | 51 | - uses: google-github-actions/release-please-action@v3 |
20 | 52 | id: release |
21 | 53 | with: |
22 | 54 | token: ${{ secrets.GITHUB_TOKEN }} |
23 | 55 | release-type: node |
24 | 56 | package-name: wait-port |
25 | | - |
| 57 | + |
26 | 58 | # If the 'release please' action has been performed, we can actually |
27 | 59 | # deploy the website. |
28 | 60 | # Note: *every* step here needs to check the 'release_created' flag. |
29 | 61 | - name: Checkout |
30 | | - uses: actions/checkout@v2 |
| 62 | + uses: actions/checkout@v3 |
31 | 63 | if: ${{ steps.release.outputs.release_created }} |
32 | 64 |
|
33 | 65 | # Setup the right version of Node.js. |
34 | | - - name: Setup Node ${{ matrix.node-version }} |
35 | | - uses: actions/setup-node@v1 |
| 66 | + - name: Setup Node |
| 67 | + uses: actions/setup-node@v3 |
36 | 68 | with: |
37 | | - node-version: ${{ matrix.node-version }} |
| 69 | + node-version: '*' |
38 | 70 | registry-url: 'https://registry.npmjs.org' |
39 | 71 | if: ${{ steps.release.outputs.release_created }} |
40 | 72 |
|
| 73 | + - name: Install dependencies |
| 74 | + run: npm ci |
| 75 | + if: ${{ steps.release.outputs.release_created }} |
| 76 | + |
41 | 77 | # Fixup Git URLs, see: |
42 | 78 | # https://stackoverflow.com/questions/70663523/the-unauthenticated-git-protocol-on-port-9418-is-no-longer-supported |
43 | 79 | - name: Fix up git URLs |
44 | 80 | run: echo -e '[url "https://github.com/"]\n insteadOf = "git://github.com/"' >> ~/.gitconfig |
45 | 81 | if: ${{ steps.release.outputs.release_created }} |
46 | 82 |
|
47 | | - # Lint, test, and report coverage. |
48 | | - - name: test |
49 | | - run: | |
50 | | - npm ci |
51 | | - npm run lint |
52 | | - npm test |
53 | | - npm run report-coverage |
54 | | - if: ${{ steps.release.outputs.release_created }} |
55 | | - |
56 | | - - name: store coverage artifacts |
57 | | - uses: actions/upload-artifact@v3 |
58 | | - with: |
59 | | - name: build-artifacts |
60 | | - path: | |
61 | | - ./artifacts/**/*.* |
62 | | - if: ${{ steps.release.outputs.release_created }} |
63 | | - |
64 | 83 | - run: npm publish |
65 | 84 | env: |
66 | 85 | NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} |
|
0 commit comments