|
1 |
| -name: Build/test |
| 1 | +name: build |
| 2 | + |
2 | 3 | on:
|
3 | 4 | push:
|
4 | 5 | branches:
|
5 | 6 | - master
|
6 | 7 | pull_request:
|
7 | 8 | branches:
|
8 | 9 | - master
|
| 10 | + release: |
| 11 | + types: |
| 12 | + - released |
| 13 | + |
| 14 | +env: |
| 15 | + NODE_BUILD_CMD: npx prebuild -r node -t 14.0.0 -t 16.0.0 -t 18.0.0 -t 20.0.0 |
| 16 | + ELECTRON_BUILD_CMD: npx prebuild -r electron -t 16.0.0 -t 17.0.0 -t 18.0.0 -t 19.0.0 -t 20.0.0 -t 21.0.0 -t 22.0.0 -t 23.0.0 -t 24.0.0 |
| 17 | + |
9 | 18 | jobs:
|
| 19 | + |
10 | 20 | test:
|
11 |
| - runs-on: ${{ matrix.os }} |
12 | 21 | strategy:
|
13 |
| - fail-fast: true |
14 | 22 | matrix:
|
15 |
| - os: [macos-latest, ubuntu-latest] |
| 23 | + os: |
| 24 | + - ubuntu-latest |
| 25 | + - macos-latest |
| 26 | + node: |
| 27 | + - 14 |
| 28 | + - 16 |
| 29 | + - 18 |
| 30 | + - 20 |
| 31 | + fail-fast: false |
| 32 | + name: Testing Node ${{ matrix.node }} on ${{ matrix.os }} |
| 33 | + runs-on: ${{ matrix.os }} |
16 | 34 | steps:
|
17 | 35 | - uses: actions/checkout@v3
|
18 | 36 | with:
|
19 | 37 | submodules: true
|
20 | 38 | fetch-depth: 0
|
21 | 39 | - uses: actions/setup-node@v3
|
22 | 40 | with:
|
23 |
| - node-version: 16 |
| 41 | + node-version: ${{ matrix.node }} |
24 | 42 | - run: npm install
|
25 | 43 | - run: npm test
|
| 44 | + |
26 | 45 | test_windows:
|
27 | 46 | runs-on: windows-latest
|
28 | 47 | steps:
|
|
35 | 54 | node-version: 16
|
36 | 55 | - run: npm install
|
37 | 56 | - run: npm run-script test-windows
|
| 57 | + |
| 58 | + publish: |
| 59 | + if: ${{ github.event_name == 'release' }} |
| 60 | + name: Publishing to NPM |
| 61 | + runs-on: ubuntu-latest |
| 62 | + needs: [ test, test_windows ] |
| 63 | + steps: |
| 64 | + - uses: actions/checkout@v3 |
| 65 | + with: |
| 66 | + submodules: true |
| 67 | + fetch-depth: 0 |
| 68 | + - uses: actions/setup-node@v3 |
| 69 | + with: |
| 70 | + node-version: 18 |
| 71 | + registry-url: https://registry.npmjs.org |
| 72 | + - run: npm publish |
| 73 | + env: |
| 74 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 75 | + |
| 76 | + prebuild: |
| 77 | + strategy: |
| 78 | + matrix: |
| 79 | + os: |
| 80 | + - ubuntu-latest |
| 81 | + - macos-latest |
| 82 | + - windows-latest |
| 83 | + fail-fast: false |
| 84 | + name: Prebuild on ${{ matrix.os }} |
| 85 | + runs-on: ${{ matrix.os }} |
| 86 | + needs: publish |
| 87 | + steps: |
| 88 | + - uses: actions/checkout@v3 |
| 89 | + with: |
| 90 | + submodules: true |
| 91 | + fetch-depth: 0 |
| 92 | + - uses: actions/setup-node@v3 |
| 93 | + with: |
| 94 | + node-version: 18 |
| 95 | + - run: npm install --ignore-scripts |
| 96 | + - run: ${{ env.NODE_BUILD_CMD }} -u ${{ secrets.GH_TOKEN }} |
| 97 | + - run: ${{ env.ELECTRON_BUILD_CMD }} -u ${{ secrets.GH_TOKEN }} |
| 98 | + - if: matrix.os == 'windows-latest' |
| 99 | + run: | |
| 100 | + ${{ env.NODE_BUILD_CMD }} --arch ia32 -u ${{ secrets.GH_TOKEN }} |
| 101 | + ${{ env.ELECTRON_BUILD_CMD }} --arch ia32 -u ${{ secrets.GH_TOKEN }} |
| 102 | + - if: matrix.os == 'macos-latest' |
| 103 | + run: | |
| 104 | + ${{ env.NODE_BUILD_CMD }} --arch arm64 -u ${{ secrets.GH_TOKEN }} |
| 105 | + ${{ env.ELECTRON_BUILD_CMD }} --arch arm64 -u ${{ secrets.GH_TOKEN }} |
0 commit comments