Skip to content
This repository was archived by the owner on Nov 16, 2025. It is now read-only.

Commit 7d918d3

Browse files
committed
this might not work
1 parent cd6ba88 commit 7d918d3

6 files changed

Lines changed: 907 additions & 153 deletions

File tree

.github/workflows/main.yml

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,28 +33,66 @@ jobs:
3333
restore-keys: |
3434
${{ runner.os }}-rust-
3535
36+
- name: Build Rust modules
37+
run: |
38+
echo "Building Rust crates under modules/ (release)..."
39+
set -e
40+
for manifest in $(find modules -name Cargo.toml -print 2>/dev/null); do
41+
crate_dir=$(dirname "$manifest")
42+
echo "Building crate: $crate_dir"
43+
cargo build --manifest-path "$crate_dir/Cargo.toml" --release
44+
done
45+
mkdir -p dist/native
46+
shell: bash
47+
3648
- name: Set up Node.js
3749
uses: actions/setup-node@v4
3850
with:
39-
node-version: '23.1.0'
51+
node-version: '18'
4052
check-latest: true
4153

4254
- name: Cache npm
4355
uses: actions/cache@v3
4456
with:
45-
path: ~/.npm
57+
path: |
58+
~/.npm
59+
node_modules
4660
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
4761
restore-keys: |
4862
${{ runner.os }}-node-
4963
5064
- name: Install dependencies
51-
run: npm install
65+
run: npm ci
5266

5367
- name: Build napi bindings
5468
run: npm run build:napi
5569

70+
- name: Collect native .node artifacts
71+
run: |
72+
set -e
73+
echo "Collecting .node files from target directories and build outputs..."
74+
mkdir -p dist/native
75+
find modules -type f -name '*.node' -print0 | xargs -0 -I{} bash -c 'cp --parents "{}" dist/native/ || true'
76+
find . -type f -path '*/target/*' -name '*.node' -print0 | xargs -0 -I{} bash -c 'cp --parents "{}" dist/native/ || true'
77+
find . -type f -name '*.node' -print0 | xargs -0 -I{} bash -c 'cp --parents "{}" dist/native/ || true'
78+
echo "Artifacts copied to dist/native"
79+
shell: bash
80+
5681
- name: Build project
5782
run: npm run build
5883

59-
- name: Clean up build artifacts
60-
run: npm run clean
84+
- name: Package binary with pkg
85+
run: |
86+
mkdir -p dist
87+
npx pkg . --targets node18-linux-x64 --output dist/bloqbit
88+
mkdir -p dist/package
89+
cp dist/bloqbit dist/package/
90+
if [ -d dist/native ]; then
91+
cp -r dist/native dist/package/native
92+
fi
93+
94+
- name: Upload package artifact
95+
uses: actions/upload-artifact@v4
96+
with:
97+
name: Bloqbit-Output
98+
path: dist/package/

0 commit comments

Comments
 (0)