Skip to content

Commit 36a0124

Browse files
committed
feat: prepare artifact build
1 parent 74a411b commit 36a0124

File tree

3 files changed

+133
-1
lines changed

3 files changed

+133
-1
lines changed

.github/workflows/artifacts.yml

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
name: Build Artifacts
2+
3+
on:
4+
push:
5+
branches: [dev]
6+
tags: ['*']
7+
workflow_dispatch: {}
8+
9+
jobs:
10+
linux-build:
11+
strategy:
12+
matrix:
13+
pack:
14+
- tag: bookworm
15+
arch: amd64
16+
os: latest
17+
- tag: bookworm
18+
arch: arm64
19+
os: 24.04-arm
20+
- tag: alpine
21+
arch: amd64
22+
os: latest
23+
- tag: alpine
24+
arch: arm64
25+
os: 24.04-arm
26+
runs-on: ubuntu-${{ matrix.pack.os }}
27+
permissions:
28+
contents: read
29+
container:
30+
image: node:22-${{ matrix.pack.tag }}
31+
env:
32+
CI: true
33+
volumes:
34+
- /:/host
35+
steps:
36+
- uses: actions/checkout@v1
37+
- name: Prepare
38+
run: |
39+
if [[ "${{ matrix.pack.tag}}" = "alpine" ]]; then
40+
apk add --no-cache cmake build-base git
41+
else
42+
apt-get update
43+
apt-get install -y cmake
44+
fi
45+
# see https://github.com/actions/runner/issues/801#issuecomment-2394425757
46+
- name: alpine tricks
47+
if: matrix.pack.tag == 'alpine' && matrix.pack.arch == 'arm64'
48+
run: |
49+
apk add nodejs
50+
sed -i "s:ID=alpine:ID=NotpineForGHA:" /etc/os-release
51+
cd /host/home/runner/runners/*/externals/
52+
rm -rf node20/*
53+
mkdir node20/bin
54+
ln -s /usr/bin/node node20/bin/node
55+
shell: sh
56+
- name: Install
57+
run: npm ci
58+
- name: Build
59+
run: npm run prebuild
60+
- name: Upload artifact
61+
uses: actions/upload-artifact@v4
62+
with:
63+
name: pack-${{ matrix.pack.tag }}-${{ matrix.pack.arch }}
64+
path: prebuilds
65+
66+
macos-build:
67+
strategy:
68+
matrix:
69+
pack:
70+
- version: latest
71+
arch: arm64
72+
- version: '13'
73+
arch: amd64
74+
runs-on: macos-${{ matrix.pack.version }}
75+
permissions:
76+
contents: read
77+
steps:
78+
- uses: actions/checkout@v1
79+
- name: Install
80+
run: npm ci
81+
- name: Build
82+
run: npm run prebuild
83+
- name: Upload artifact
84+
uses: actions/upload-artifact@v4
85+
with:
86+
name: pack-macos-${{ matrix.pack.arch }}
87+
path: prebuilds
88+
89+
windows-build:
90+
runs-on: windows-latest
91+
permissions:
92+
contents: read
93+
steps:
94+
- uses: actions/checkout@v1
95+
- name: Install
96+
run: npm ci
97+
- name: Build (x64)
98+
run: npm run prebuild
99+
- name: Build (x86)
100+
run: |
101+
$Env:NODE_ARCH = "x86"
102+
npm run prebuild
103+
- name: Upload artifact
104+
uses: actions/upload-artifact@v4
105+
with:
106+
name: pack-windows
107+
path: prebuilds
108+
109+
publish:
110+
runs-on: ubuntu-latest
111+
if: github.event_name == 'push'
112+
needs:
113+
- linux-build
114+
- macos-build
115+
- windows-build
116+
permissions:
117+
contents: write
118+
steps:
119+
- name: Download artifscts
120+
uses: actions/download-artifact@v4
121+
with:
122+
merge-multiple: true
123+
- name: Display
124+
run: ls -lhaR
125+
- uses: ncipollo/release-action@v1
126+
with:
127+
artifacts: '*.tar.br'
128+
token: ${{ secrets.GITHUB_TOKEN }}
129+
prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'alpha') || contains(github.ref, 'rc') }}
130+
draft: true
131+
generateReleaseNotes: true

scripts/flac-prebuild.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const run = async (command, args = [], pipe = true) => {
2323
const proc = cp.spawn(command, args, {
2424
encoding: 'utf-8',
2525
stdio: pipe ? 'inherit' : undefined,
26+
shell: process.platform === 'win32',
2627
})
2728

2829
await once(proc, 'exit')

src/test_async.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include "utils/async.hpp"
2-
#include <napi.h>
2+
#include <chrono>
33
#include <thread>
44

55
namespace flac_bindings {

0 commit comments

Comments
 (0)