-
Notifications
You must be signed in to change notification settings - Fork 1
90 lines (76 loc) · 2.71 KB
/
Copy pathpublish-node.yml
File metadata and controls
90 lines (76 loc) · 2.71 KB
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
85
86
87
88
89
90
name: Publish Node
on:
workflow_dispatch:
jobs:
build:
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
binary: schema_analysis-linux-x64
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
binary: schema_analysis-linux-arm64
- os: macos-latest
target: x86_64-apple-darwin
binary: schema_analysis-darwin-x64
- os: macos-latest
target: aarch64-apple-darwin
binary: schema_analysis-darwin-arm64
- os: windows-latest
target: x86_64-pc-windows-msvc
binary: schema_analysis-win32-x64.exe
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install cross-compilation tools (Linux ARM64)
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> "$GITHUB_ENV"
rustup target add aarch64-unknown-linux-gnu
- name: Install cross-compilation target (macOS x86_64)
if: matrix.target == 'x86_64-apple-darwin'
run: rustup target add x86_64-apple-darwin
- name: Build
run: cargo build --release --features cli --target ${{ matrix.target }}
working-directory: schema_analysis
- name: Rename binary (unix)
if: runner.os != 'Windows'
run: |
mkdir -p packages/node/binaries
cp target/${{ matrix.target }}/release/schema_analysis packages/node/binaries/${{ matrix.binary }}
- name: Rename binary (windows)
if: runner.os == 'Windows'
shell: bash
run: |
mkdir -p packages/node/binaries
cp target/${{ matrix.target }}/release/schema_analysis.exe packages/node/binaries/${{ matrix.binary }}
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.binary }}
path: packages/node/binaries/${{ matrix.binary }}
publish:
needs: build
runs-on: ubuntu-latest
environment: npm
permissions:
id-token: write
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v4
with:
node-version: 22
registry-url: https://registry.npmjs.org
- uses: actions/download-artifact@v4
with:
path: packages/node/binaries
merge-multiple: true
- run: chmod +x packages/node/binaries/*
- run: npx npm@latest publish --provenance
working-directory: packages/node