-
Notifications
You must be signed in to change notification settings - Fork 3
59 lines (57 loc) · 1.78 KB
/
publish.yml
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
on:
push:
tags:
- "*"
name: build and publish to npm
jobs:
build:
name: Build - ${{ matrix.platform.os }} ${{ matrix.arch }}
strategy:
matrix:
platform:
- os: linux
target_suffix: -unknown-linux-gnu
output: libvenbind.so
arch: [x86_64]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: cachix/install-nix-action@v26
- uses: cachix/cachix-action@v14
with:
name: devenv
- name: Install devenv.sh
run: nix profile install nixpkgs#devenv
- name: Build
shell: devenv shell bash -- -e {0}
run: |
cargo build --release --target ${{ matrix.arch }}${{ matrix.platform.target_suffix }}
mkdir dist
cp ./target/${{ matrix.arch }}${{ matrix.platform.target_suffix }}/release/${{ matrix.platform.output }} ./dist/venbind-${{ matrix.platform.os }}-${{ matrix.arch }}.node
- name: Upload
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.platform.os }}-${{ matrix.arch }}
path: ./dist/venbind-${{ matrix.platform.os }}-${{ matrix.arch }}.node
publish:
name: Publish
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# TODO: check tag and make sure it matches across tag, package.json, and Cargo.toml
- name: Install Node
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: "https://registry.npmjs.org"
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: prebuilds
- name: Publish to npm
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}