-
Notifications
You must be signed in to change notification settings - Fork 0
118 lines (97 loc) · 3.11 KB
/
release.yml
File metadata and controls
118 lines (97 loc) · 3.11 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
name: Release
on:
release:
types: [created]
permissions:
contents: write
id-token: write
jobs:
build-binaries:
name: Build Native Binary
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact_name: liblayout_engine.so
rename_to: liblayout_engine-linux-x64.so
- os: macos-14
target: aarch64-apple-darwin
artifact_name: liblayout_engine.dylib
rename_to: liblayout_engine-darwin-arm64.dylib
steps:
- uses: actions/checkout@v4
# Rustビルドキャッシュ
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
src/layout-engine/target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('src/layout-engine/src/lib.rs') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Setup mise
uses: jdx/mise-action@v2
with:
cache: true
- name: Install toolchains
run: mise install
- name: Install dependencies
run: mise exec -- bun install --frozen-lockfile
- name: Build Binary
run: mise run build:ffi
- name: Prepare Artifact
run: |
mkdir -p output
cp "src/layout-engine/target/release/${{ matrix.artifact_name }}" "output/${{ matrix.rename_to }}"
- uses: actions/upload-artifact@v4
with:
name: binary-${{ matrix.target }}
path: output/*
publish:
needs: build-binaries
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup mise
uses: jdx/mise-action@v2
with:
cache: true
- name: Install toolchains
run: mise install
- name: Install dependencies
run: mise exec -- bun install --frozen-lockfile
- name: Download all binaries
uses: actions/download-artifact@v4
with:
path: native-temp
pattern: binary-*
merge-multiple: true
- name: Organize binaries
run: |
mkdir -p src/layout-engine/native
mv native-temp/* src/layout-engine/native/
ls -R src/layout-engine/native/
- name: Create distributable package tarball
run: |
rm -rf dist
mkdir -p dist/package
cp package.json README.md tsconfig.json dist/package/
rsync -a --exclude 'layout-engine/target' src/ dist/package/src/
tar -czf "dist/btuin-${{ github.event.release.tag_name }}.tgz" -C dist package
ls -la dist
- name: Upload package to GitHub Release
uses: softprops/action-gh-release@v2
with:
files: dist/*.tgz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node for npmjs (Trusted Publishing)
uses: actions/setup-node@v4
with:
node-version: 24
registry-url: https://registry.npmjs.org
- name: Publish to npmjs.com (OIDC)
run: npm publish --access public