This repository has been archived by the owner on Jul 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (67 loc) · 2.06 KB
/
publish-node.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: Publish Node Addon
on:
workflow_dispatch:
# Enables manual triggering via GitHub Actions
push:
tags:
- 'v*'
jobs:
build:
timeout-minutes: 5
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-xlarge]
steps:
- name: Check out the code
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '18'
registry-url: 'https://npm.pkg.github.com'
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Install dependencies
run: npm install
- name: Build package
run: npm run build-release
- name: Run test
run: npm start
- name: Rename and move binary
run: |
mkdir -p ./binaries
mv index.node ./binaries/index-${{ matrix.os }}.node
- name: Upload binary artifact
uses: actions/upload-artifact@v2
with:
name: binary-${{ matrix.os }}
path: ./binaries/index-${{ matrix.os }}.node
publish:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '18'
registry-url: 'https://npm.pkg.github.com/'
scope: '@robocorp'
- name: Download all artifacts
uses: actions/download-artifact@v2
with:
path: ./artifacts
- name: Prepare package
run: |
mkdir -p ./binaries
mv ./artifacts/binary-ubuntu-latest/index-ubuntu-latest.node ./binaries/
mv ./artifacts/binary-windows-latest/index-windows-latest.node ./binaries/
mv ./artifacts/binary-macos-latest/index-macos-latest.node ./binaries/
mv ./artifacts/binary-macos-latest-xlarge/index-macos-latest-xlarge.node ./binaries/index-macos-arm-latest.node
- name: Publish to GitHub Packages
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}