Skip to content

Commit 7d0a74c

Browse files
committed
fix(release): publish npm packages sequentially to avoid E409
The npm registry can return E409 Conflict when multiple packages in the same scope are published simultaneously. This happens because npm publish --workspaces publishes all packages in parallel. Change to sequential publishing with 2-second delays between packages: 1. Platform packages first (darwin-arm64/x64 variants) 2. Dev package (headers only) 3. Meta packages last (depend on platform packages) This adds ~20 seconds to the release but avoids the race condition.
1 parent 96ad78a commit 7d0a74c

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

.github/workflows/release.yml

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,31 @@ jobs:
282282
artifacts-download/*.tar.gz \
283283
artifacts-download/*.sha256 --clobber
284284
285-
- name: Publish to npm
286-
working-directory: npm
287-
run: npm publish --workspaces --access public --provenance
285+
- name: Publish to npm (sequential to avoid E409)
288286
env:
289287
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
288+
run: |
289+
cd npm
290+
291+
# Publish sequentially to avoid npm registry race condition (E409)
292+
# Platform packages first (dependencies for meta packages)
293+
for pkg in darwin-arm64 darwin-arm64-lgpl darwin-arm64-gpl \
294+
darwin-x64 darwin-x64-lgpl darwin-x64-gpl; do
295+
echo "Publishing $pkg..."
296+
npm publish -w "$pkg" --access public --provenance
297+
sleep 2 # Let registry process before next publish
298+
done
299+
300+
# Dev package (headers only, independent)
301+
echo "Publishing dev..."
302+
npm publish -w dev --access public --provenance
303+
sleep 2
304+
305+
# Meta packages last (have optionalDependencies on platform packages)
306+
for pkg in ffmpeg ffmpeg-lgpl ffmpeg-gpl; do
307+
echo "Publishing $pkg..."
308+
npm publish -w "$pkg" --access public --provenance
309+
sleep 2
310+
done
311+
312+
echo "All packages published successfully"

0 commit comments

Comments
 (0)