Skip to content

Commit e542e90

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

File tree

3 files changed

+131
-1
lines changed

3 files changed

+131
-1
lines changed

.github/workflows/artifacts.yml

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