|
7 | 7 | pull_request: |
8 | 8 | branches: |
9 | 9 | - master |
| 10 | + release: |
| 11 | + types: |
| 12 | + - released |
10 | 13 |
|
11 | 14 | env: |
12 | | - NODE_PREBUILD_CMD: npx prebuild -t 10.0.0 -t 12.0.0 -t 14.0.0 -t 16.0.0 -t 18.0.0 -t 20.0.0 --strip |
13 | | - ELECTRON_PREBUILD_CMD: npx prebuild -r electron -t 3.0.0 -t 4.0.0 -t 5.0.0 -t 6.0.0 -t 7.0.0 -t 8.0.0 -t 9.0.0 -t 10.0.0 -t 11.0.0 -t 12.0.0 -t 13.0.0 -t 14.0.0 -t 15.0.0 -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 -t 25.0.0 --strip |
| 15 | + NODE_PREBUILD_CMD: npx prebuild -t 10.0.0 -t 12.0.0 -t 14.0.0 -t 16.0.0 -t 18.0.0 -t 20.0.0 --strip -u ${{ secrets.GH_TOKEN }} |
| 16 | + ELECTRON_PREBUILD_CMD: npx prebuild -r electron -t 3.0.0 -t 4.0.0 -t 5.0.0 -t 6.0.0 -t 7.0.0 -t 8.0.0 -t 9.0.0 -t 10.0.0 -t 11.0.0 -t 12.0.0 -t 13.0.0 -t 14.0.0 -t 15.0.0 -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 -t 25.0.0 --strip -u ${{ secrets.GH_TOKEN }} |
14 | 17 |
|
15 | 18 | jobs: |
16 | 19 |
|
@@ -43,55 +46,48 @@ jobs: |
43 | 46 | - run: npm install |
44 | 47 | - run: npm test |
45 | 48 |
|
| 49 | + publish: |
| 50 | + if: ${{ github.event_name == 'release' }} |
| 51 | + name: Publish to npm |
| 52 | + runs-on: ubuntu-latest |
| 53 | + needs: test |
| 54 | + steps: |
| 55 | + - uses: actions/checkout@v3 |
| 56 | + with: |
| 57 | + submodules: true |
| 58 | + fetch-depth: 0 |
| 59 | + - uses: actions/setup-node@v3 |
| 60 | + with: |
| 61 | + node-version: 20 |
| 62 | + registry-url: https://registry.npmjs.org |
| 63 | + - run: npm install |
| 64 | + - run: npm publish --access public |
| 65 | + env: |
| 66 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 67 | + |
46 | 68 | prebuild: |
47 | 69 | strategy: |
48 | 70 | matrix: |
49 | 71 | os: |
50 | 72 | - windows-2019 |
51 | 73 | - macos-latest |
52 | 74 | - ubuntu-latest |
53 | | - node: |
54 | | - # Node 10-14 fails to prebuild for Node 18+ |
55 | | - # |
56 | | - # macos-latest's Python version is too new to work with the node-gyp |
57 | | - # bundled by prebuild and the "overrides" in package.json for node-gyp |
58 | | - # doesn't work before npm 8.3 (Node 16) |
59 | | - # |
60 | | - # ubuntu-latest has a similar issue but in this case the error is more direct: |
61 | | - # #error "It looks like you are building this native module without |
62 | | - # using the right config.gypi. This normally means that you need to |
63 | | - # update electron-rebuild (>=3.2.8) or node-gyp (>=8.4.0) if you're |
64 | | - # building modules directly." |
65 | | - # |
66 | | - # windows-2019 fails with |
67 | | - # gyp: name 'llvm_version' is not defined while evaluating condition |
68 | | - # 'llvm_version=="0.0"' in binding.gyp while trying to load binding.gyp |
69 | | - # - 10 |
70 | | - # - 12 |
71 | | - # - 14 |
72 | | - - 16 |
73 | | - - 18 |
74 | | - - 20 |
75 | 75 | fail-fast: false |
76 | | - name: Prebuild with Node ${{ matrix.node }} on ${{ matrix.os }} |
| 76 | + name: Prebuild for ${{ matrix.os }} |
77 | 77 | runs-on: ${{ matrix.os }} |
78 | | - # needs: test |
| 78 | + needs: publish |
79 | 79 | steps: |
80 | 80 | - uses: actions/checkout@v3 |
81 | 81 | with: |
82 | 82 | submodules: true |
83 | 83 | fetch-depth: 0 |
84 | 84 | - uses: actions/setup-node@v3 |
85 | 85 | with: |
86 | | - node-version: ${{ matrix.node }} |
| 86 | + node-version: 20 |
87 | 87 | - run: npm install |
88 | | - - if: matrix.os == 'windows-latest' |
89 | | - run: ${{ env.NODE_PREBUILD_CMD }} --arch ia32 |
90 | | - - if: matrix.os == 'windows-latest' |
91 | | - run: ${{ env.ELECTRON_PREBUILD_CMD }} --arch ia32 |
92 | | - - if: matrix.os == 'macos-latest' |
| 88 | + - if: runner.os == 'macOS' |
93 | 89 | run: ${{ env.NODE_PREBUILD_CMD }} --arch arm64 |
94 | | - - if: matrix.os == 'macos-latest' |
| 90 | + - if: runner.os == 'macOS' |
95 | 91 | run: ${{ env.ELECTRON_PREBUILD_CMD }} --arch arm64 |
96 | 92 | - run: ${{ env.NODE_PREBUILD_CMD }} |
97 | 93 | - run: ${{ env.ELECTRON_PREBUILD_CMD }} |
0 commit comments