Skip to content

Commit 823fa69

Browse files
committed
add GA
1 parent 561f19d commit 823fa69

1 file changed

Lines changed: 115 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: Build & Publish
2+
3+
on: workflow_dispatch
4+
5+
jobs:
6+
build:
7+
name: Build ${{ matrix.os }} / ${{ matrix.arch }}
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
include:
12+
# Linux
13+
- os: ubuntu-24.04
14+
platform: linux
15+
arch: x64
16+
- os: ubuntu-24.04
17+
platform: linux
18+
arch: arm64
19+
# macOS
20+
- os: macos-15 # Apple Silicon runner; clang can cross-compile x64 too
21+
platform: darwin
22+
arch: arm64
23+
- os: macos-15
24+
platform: darwin
25+
arch: x64
26+
# Windows
27+
# - os: windows-2022
28+
# platform: win
29+
# arch: x64
30+
# - os: windows-2022
31+
# platform: win
32+
# arch: arm64
33+
34+
runs-on: ${{ matrix.os }}
35+
36+
steps:
37+
- uses: actions/checkout@v4
38+
- name: Setup node using cache (faster)
39+
uses: actions/setup-node@v4
40+
with:
41+
node-version: '22.17.1'
42+
43+
- run: npm ci --production
44+
45+
# ----- Linux: prepare cross toolchain for arm64 -----
46+
- name: Install aarch64 cross toolchain (Linux arm64)
47+
if: matrix.platform == 'linux' && matrix.arch == 'arm64'
48+
run: |
49+
sudo apt-get update
50+
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
51+
echo "CC=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
52+
echo "CXX=aarch64-linux-gnu-g++" >> $GITHUB_ENV
53+
54+
- run: npx node-gyp rebuild --arch=${{ matrix.arch }}
55+
56+
# ----- Collect and normalize the output name -----
57+
- name: Stage artifact (Linux/macOS)
58+
if: matrix.platform != 'win'
59+
shell: bash
60+
run: |
61+
if [ "${{ matrix.platform }}" = "darwin" ]; then ext="dylib"; else ext="so"; fi
62+
cp "build/Release/keep_last.$ext" build/Release/${{ matrix.platform }}-${{ matrix.arch }}-keep_last.$ext
63+
64+
# ----- Upload per-target artifact -----
65+
- name: Upload artifact
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: replic-sqlite-${{ matrix.platform }}-${{ matrix.arch }}
69+
path: build/Release/${{ matrix.platform }}-${{ matrix.arch }}-keep_last.*
70+
71+
pack:
72+
name: Assemble & Publish
73+
needs: build
74+
runs-on: ubuntu-latest
75+
steps:
76+
- name: Checkout
77+
uses: actions/checkout@v4
78+
79+
- name: Download all artifacts
80+
uses: actions/download-artifact@v4
81+
with:
82+
path: .
83+
84+
# List all files for debugging
85+
- name: List all files (debug)
86+
run: |
87+
echo "Listing all files recursively from workspace root:"
88+
find . -type f -print | sort
89+
90+
# Move downloaded folders under sqlite-ext/keep_last/
91+
# - name: Layout compiled libraries
92+
# run: ls -la
93+
#
94+
# # Ensure the tag matches package.json version to prevent accidental publishes
95+
# - name: Verify version matches tag
96+
# run: |
97+
# PKG_VERSION=$(node -p "require('./package.json').version")
98+
# TAG=${GITHUB_REF_NAME#v}
99+
# echo "package.json: $PKG_VERSION, tag: $TAG"
100+
# [ "$PKG_VERSION" = "$TAG" ] || { echo "Version mismatch"; exit 1; }
101+
#
102+
# - name: Setup Node (for publish)
103+
# uses: actions/setup-node@v4
104+
# with:
105+
# node-version: '22.17.1'
106+
# registry-url: 'https://registry.npmjs.org'
107+
#
108+
# - name: Preview npm tarball
109+
# run: npm pack --dry-run
110+
#
111+
# - name: Publish to npm
112+
# if: startsWith(github.ref, 'refs/tags/v')
113+
# env:
114+
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
115+
# run: npm publish --access public

0 commit comments

Comments
 (0)