Skip to content

Commit d078425

Browse files
committed
NPM Publish Github Workflow
Figured out how github actions work. We should (hopefully) now have an automatic system for prebuilds on both win32-x64 and linux-x64
1 parent 39d1725 commit d078425

6 files changed

Lines changed: 131 additions & 199 deletions

File tree

.github/workflows/npm-publish.yml

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,52 @@
1-
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
3-
41
name: Node.js Package
52

63
on:
74
release:
85
types: [created]
96

107
jobs:
11-
build:
8+
build-linux-x64:
129
runs-on: ubuntu-latest
1310
steps:
1411
- uses: actions/checkout@v2
1512
- uses: actions/setup-node@v2
13+
with: node-version: 14
14+
- run: npm install
15+
- run: npm run prebuild
16+
- uses: actions/upload-artifact@v2
1617
with:
17-
node-version: 14
18-
- run: npm ci
19-
- run: npm test
20-
21-
publish-npm:
22-
needs: build
23-
runs-on: ubuntu-latest
18+
name: linux-x64
19+
path: prebuilds/linux-x64/
20+
build-win32-x64:
21+
runs-on: windows-latest
2422
steps:
2523
- uses: actions/checkout@v2
2624
- uses: actions/setup-node@v2
25+
with: node-version: 14
26+
- run: npm install
27+
- run: npm run prebuild
28+
- uses: actions/upload-artifact@v2
2729
with:
28-
node-version: 14
29-
registry-url: https://registry.npmjs.org/
30-
- run: npm ci
31-
- run: npm publish
32-
env:
33-
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
34-
35-
publish-gpr:
36-
needs: build
30+
name: win32-x64
31+
path: prebuilds/win32-x64/
32+
publish-npm:
3733
runs-on: ubuntu-latest
38-
permissions:
39-
contents: read
40-
packages: write
34+
needs: [build-linux-x64, build-win32-x64]
4135
steps:
4236
- uses: actions/checkout@v2
4337
- uses: actions/setup-node@v2
4438
with:
4539
node-version: 14
46-
registry-url: https://npm.pkg.github.com/
47-
- run: npm ci
40+
registry-url: https://registry.npmjs.org/
41+
- uses: actions/download-artifact@v2
42+
with:
43+
name: linux-x64
44+
path: prebuilds/
45+
- uses: actions/download-artifact@v2
46+
with:
47+
name: win32-x64
48+
path: prebuilds/
49+
- run: npm install
4850
- run: npm publish
4951
env:
50-
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
52+
NODE_AUTH_TOKEN: ${{ secrets.npm_token }}

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ node_modules/
22
node-addon-api/
33
build/
44
test/test_linux
5-
test/test_win.exe
5+
test/test_win.exe
6+
prebuilds/

0 commit comments

Comments
 (0)