-
Notifications
You must be signed in to change notification settings - Fork 5
98 lines (84 loc) · 3.29 KB
/
Copy pathrelease.yml
File metadata and controls
98 lines (84 loc) · 3.29 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
91
92
93
94
95
96
97
98
name: Release
on:
release:
types: [published]
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
# Linux x64
- os: ubuntu-latest
lib-name: libimageflow_node.so
artifact-name: libimageflow-linux-x64.node
# Linux arm64
- os: ubuntu-24.04-arm
lib-name: libimageflow_node.so
artifact-name: libimageflow-linux-arm64.node
# macOS arm64 (Apple Silicon)
- os: macos-latest
lib-name: libimageflow_node.dylib
artifact-name: libimageflow-macos-arm64.node
# macOS x64
- os: macos-13
lib-name: libimageflow_node.dylib
artifact-name: libimageflow-macos-x64.node
# Windows x64
- os: windows-latest
lib-name: imageflow_node.dll
artifact-name: libimageflow-win-x64.node
# Windows arm64 (cross-compiled from x64)
- os: windows-latest
lib-name: imageflow_node.dll
artifact-name: libimageflow-win-arm64.node
rust-target: aarch64-pc-windows-msvc
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '20'
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.rust-target || '' }}
- name: Cache Cargo
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
native/target
key: ${{ runner.os }}-${{ runner.arch }}-${{ matrix.rust-target || 'native' }}-cargo-release-${{ hashFiles('native/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-${{ matrix.rust-target || 'native' }}-cargo-release-
- name: Build native module (release, cross-compile)
if: matrix.rust-target
working-directory: native
run: cargo build --release --target ${{ matrix.rust-target }}
- name: Build native module (release, native)
if: '!matrix.rust-target'
working-directory: native
run: cargo build --release
- name: Copy release artifact (cross-compile, Unix)
if: matrix.rust-target && runner.os != 'Windows'
run: cp native/target/${{ matrix.rust-target }}/release/${{ matrix.lib-name }} ${{ matrix.artifact-name }}
- name: Copy release artifact (cross-compile, Windows)
if: matrix.rust-target && runner.os == 'Windows'
shell: bash
run: cp native/target/${{ matrix.rust-target }}/release/${{ matrix.lib-name }} ${{ matrix.artifact-name }}
- name: Copy release artifact (native, Unix)
if: '!matrix.rust-target && runner.os != ''Windows'''
run: cp native/target/release/${{ matrix.lib-name }} ${{ matrix.artifact-name }}
- name: Copy release artifact (native, Windows)
if: '!matrix.rust-target && runner.os == ''Windows'''
shell: bash
run: cp native/target/release/${{ matrix.lib-name }} ${{ matrix.artifact-name }}
- name: Upload to release
uses: softprops/action-gh-release@v2
with:
files: ${{ matrix.artifact-name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}