@@ -2,74 +2,13 @@ name: Release
22
33on :
44 workflow_run :
5- workflows : ["CI "]
5+ workflows : ["Prepare Release "]
66 types :
77 - completed
88
99jobs :
10- build-binaries :
11- if : >
12- github.event.workflow_run.conclusion == 'success' &&
13- github.event.workflow_run.head_branch == 'master' &&
14- startsWith(github.event.workflow_run.head_commit.message, 'chore(release)')
15- runs-on : ubuntu-latest
16- strategy :
17- fail-fast : false
18- matrix :
19- include :
20- - platform : linux
21- arch : x64
22- binary : vendor/lame/linux-x64/lame
23- - platform : darwin
24- arch : arm64
25- binary : vendor/lame/darwin-arm64/lame
26- - platform : win32
27- arch : x64
28- binary : vendor/lame/win32-x64/lame.exe
29- steps :
30- - name : Checkout
31- uses : actions/checkout@v4
32- with :
33- repository : ${{ github.event.workflow_run.head_repository.full_name }}
34- ref : ${{ github.event.workflow_run.head_commit.id }}
35- fetch-depth : 0
36-
37- - name : Setup pnpm
38- uses : pnpm/action-setup@v4
39-
40- - name : Setup Node.js
41- uses : actions/setup-node@v4
42- with :
43- node-version : 20.x
44- cache : pnpm
45-
46- - name : Install dependencies
47- env :
48- LAME_SKIP_DOWNLOAD : " 1"
49- run : pnpm install --frozen-lockfile
50-
51- - name : Download LAME binary for ${{ matrix.platform }}-${{ matrix.arch }}
52- env :
53- NODE_LAME_PLATFORM : ${{ matrix.platform }}
54- NODE_LAME_ARCH : ${{ matrix.arch }}
55- LAME_FORCE_DOWNLOAD : " 1"
56- run : node scripts/install-lame.mjs
57-
58- - name : Package binary
59- run : node scripts/package-lame.mjs --binary "${{ matrix.binary }}" --platform "${{ matrix.platform }}" --arch "${{ matrix.arch }}" --out-dir artifacts
60-
61- - name : Upload artifacts
62- uses : actions/upload-artifact@v4
63- with :
64- name : lame-${{ matrix.platform }}-${{ matrix.arch }}
65- path : artifacts
66-
6710 publish :
68- needs : build-binaries
69- if : >
70- github.event.workflow_run.conclusion == 'success' &&
71- github.event.workflow_run.head_branch == 'master' &&
72- startsWith(github.event.workflow_run.head_commit.message, 'chore(release)')
11+ if : github.event.workflow_run.conclusion == 'success'
7312 runs-on : ubuntu-latest
7413 permissions :
7514 contents : write
@@ -95,49 +34,11 @@ jobs:
9534 - name : Install dependencies
9635 run : pnpm install --frozen-lockfile
9736
98- - name : Download artifacts
99- uses : actions/download-artifact@v4
100- with :
101- path : artifacts
102-
103- - name : Unpack binaries into vendor directory
104- run : node scripts/unpack-lame-artifacts.mjs artifacts vendor/lame
105-
10637 - name : Build package
10738 run : pnpm run build
10839
109- - name : Prepare release assets
110- run : |
111- set -eo pipefail
112- VERSION=$(node -p "require('./package.json').version")
113- ASSET_DIR="$PWD/release-assets"
114- mkdir -p "$ASSET_DIR"
115- while IFS= read -r manifest; do
116- base=$(basename "$manifest" .json)
117- src_dir="vendor/lame/$base"
118- if [ ! -d "$src_dir" ]; then
119- echo "Skipping $base - no vendor directory"
120- continue
121- fi
122- tmp_dir=$(mktemp -d)
123- cp "$src_dir"/* "$tmp_dir/"
124- cp "$manifest" "$tmp_dir/manifest.json"
125- (cd "$tmp_dir" && zip -qr "$ASSET_DIR/node-lame-v${VERSION}-${base}.zip" .)
126- rm -rf "$tmp_dir"
127- done < <(find artifacts -maxdepth 3 -name '*.json')
128- zip -qr "$ASSET_DIR/node-lame-v${VERSION}-dist.zip" dist
129-
130- - name : Publish release
40+ - name : Publish package
13141 env :
13242 NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
13343 NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
134- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
13544 run : pnpm run release:publish
136-
137- - name : Upload assets to GitHub release
138- env :
139- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
140- run : |
141- VERSION=$(node -p "require('./package.json').version")
142- TAG="v${VERSION}"
143- gh release upload "$TAG" release-assets/*.zip --clobber
0 commit comments