Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build

on:
push:
workflow_dispatch:

jobs:
prebuild:
strategy:
matrix:
include:
- os: ubuntu-22.04
platform: linux
- os: macos-14
platform: darwin
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: 22

- name: Install system dependencies (Linux)
if: matrix.platform == 'linux'
run: sudo apt-get update && sudo apt-get install -y libvpx-dev

- name: Install system dependencies (macOS)
if: matrix.platform == 'darwin'
run: brew install libvpx

- name: Install dependencies (skip native build)
run: yarn install --frozen-lockfile --ignore-scripts

- name: Download FFmpeg static libraries
run: node install_ffmpeg_static.js

- name: Build prebuild
run: npx prebuild --strip -r node -t 22.0.0
env:
FFMPEG_STATIC: "1"

- name: List prebuilds
run: find prebuilds -name "*.tar.gz" -ls

- name: Upload prebuild artifact
uses: actions/upload-artifact@v4
with:
name: prebuild-${{ matrix.platform }}
path: prebuilds/**/*.tar.gz
72 changes: 0 additions & 72 deletions .github/workflows/prebuild.yml

This file was deleted.

32 changes: 0 additions & 32 deletions .github/workflows/publish-npm.yml

This file was deleted.

53 changes: 53 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Release

on:
workflow_run:
workflows: [Build]
types: [completed]
branches: [main]

jobs:
release:
if: github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: 22
registry-url: https://registry.npmjs.org/

- name: Get package version
id: version
run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT

- name: Download prebuild artifacts from build workflow
uses: actions/download-artifact@v4
with:
path: prebuilds
pattern: prebuild-*
merge-multiple: true
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: List all prebuilds
run: find prebuilds -name "*.tar.gz" -ls

- name: Create or update GitHub release
run: |
VERSION="v${{ steps.version.outputs.version }}"
if gh release view "$VERSION" >/dev/null 2>&1; then
echo "Release $VERSION exists, uploading prebuilds..."
else
echo "Creating release $VERSION..."
gh release create "$VERSION" --title "$VERSION" --notes "Prebuilt binaries for version $VERSION"
fi
find prebuilds -name "*.tar.gz" -exec gh release upload "$VERSION" {} --clobber \;
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish to npm
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.npm_token }}
22 changes: 22 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Prebuilds are downloaded from GitHub releases, not bundled in npm
prebuilds/

# Build artifacts
build/

# FFmpeg libraries (downloaded at install time)
ffmpeg/

# Development files
.circleci/
.github/
.claude/
test/
scratch/
examples/
images/
*.tgz

# Editor/IDE
.vscode/
*.swp
19 changes: 14 additions & 5 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -110,28 +110,37 @@
"../ffmpeg/ffmpeg-static-build/lib/libpostproc.a",
"../ffmpeg/ffmpeg-static-build/lib/libswresample.a",
"../ffmpeg/ffmpeg-static-build/lib/libswscale.a",
"-framework AVFoundation",
"-framework VideoToolbox",
"-framework CoreMedia",
"-framework CoreVideo",
"-framework CoreFoundation",
"-framework CoreGraphics",
"-framework CoreImage",
"-framework AppKit",
"-framework OpenGL",
"-framework Security",
"-framework AudioToolbox",
"-lvpx",
"/opt/homebrew/lib/libvpx.a",
"-lbz2",
"-lz",
"-liconv",
"-lm"
],
"xcode_settings": {
"OTHER_LDFLAGS": [
"-all_load",
"-framework AVFoundation",
"-framework VideoToolbox",
"-framework CoreMedia",
"-framework CoreVideo",
"-framework CoreFoundation",
"-framework CoreGraphics",
"-framework CoreImage",
"-framework AppKit",
"-framework OpenGL",
"-framework Security",
"-framework AudioToolbox",
"-exported_symbols_list",
"<(module_root_dir)/exports.txt"
"-framework AudioToolbox"
]
}
}],
Expand Down Expand Up @@ -160,7 +169,7 @@
"../ffmpeg/ffmpeg-static-build/lib/libpostproc.a",
"../ffmpeg/ffmpeg-static-build/lib/libswresample.a",
"../ffmpeg/ffmpeg-static-build/lib/libswscale.a",
"-lvpx",
"-l:libvpx.a",
"-lz",
"-lm",
"-lpthread",
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
{
"name": "@lumen5/beamcoder",
"version": "0.0.6",
"version": "0.0.22",
"description": "Node.js native bindings to FFmpeg.",
"main": "index.js",
"types": "index.d.ts",
"scripts": {
"preinstall": "node install_ffmpeg_static.js",
"install": "prebuild-install || (FFMPEG_STATIC=1 node-gyp rebuild)",
"install": "prebuild-install || (node install_ffmpeg_static.js && FFMPEG_STATIC=1 node-gyp rebuild)",
"preinstall:dynamic": "node install_ffmpeg.js",
"install:dynamic": "FFMPEG_STATIC=0 node-gyp rebuild",
"build:dynamic": "npm run preinstall:dynamic && npm run install:dynamic",
Expand Down
Loading