Skip to content
Open
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
57 changes: 57 additions & 0 deletions .github/workflows/prebuild.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Prebuild

on:
push:
branches: [main, prebuild-*]
pull_request:
branches: [main]
release:
types: [created]

jobs:
prebuild:
strategy:
matrix:
os: [ubuntu-latest]
node-version: [18, 20]
arch: [x64]
runs-on: ${{ matrix.os }}
env:
CPATH: /tmp/beamcoder/.ffmpeg/ffmpeg/include/
PKG_CONFIG_PATH: /tmp/beamcoder/.ffmpeg/ffmpeg/lib/pkgconfig/
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
registry-url: https://registry.npmjs.org/

- name: Setup build environment
run: |
mkdir /tmp/beamcoder
cp -r . /tmp/beamcoder
sudo apt-get update && sudo apt-get install -y libvpx-dev

- name: Install dependencies
working-directory: /tmp/beamcoder
run: |
sudo ./scripts/install_beamcoder_dependencies.sh
yarn install --frozen-lockfile

- name: Build prebuilt binary
working-directory: /tmp/beamcoder
run: npm run prebuild

- name: Upload prebuilt binary
working-directory: /tmp/beamcoder
run: npx prebuild --upload ${{ secrets.GITHUB_TOKEN }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Test prebuilt binary
working-directory: /tmp/beamcoder
run: |
rm -rf node_modules build
yarn install --frozen-lockfile
yarn test
50 changes: 39 additions & 11 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,53 @@ on:
types: [created]

jobs:
publish-npm:
runs-on: ubuntu-latest
prebuild:
strategy:
matrix:
os: [ubuntu-latest]
node-version: [18, 20]
arch: [x64]
runs-on: ${{ matrix.os }}
env:
CPATH: /tmp/beamcoder/.ffmpeg/ffmpeg/include/
PKG_CONFIG_PATH: /tmp/beamcoder/.ffmpeg/ffmpeg/lib/pkgconfig/
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
node-version: ${{ matrix.node-version }}
registry-url: https://registry.npmjs.org/
- run: mkdir /tmp/beamcoder
- run: cp -r . /tmp/beamcoder
- run: sudo apt-get update && sudo apt-get install -y libvpx-dev
- run: sudo ./scripts/install_beamcoder_dependencies.sh

- name: Setup build environment
run: |
mkdir /tmp/beamcoder
cp -r . /tmp/beamcoder
sudo apt-get update && sudo apt-get install -y libvpx-dev

- name: Install dependencies
working-directory: /tmp/beamcoder
- run: yarn install --frozen-lockfile
run: |
sudo ./scripts/install_beamcoder_dependencies.sh
yarn install --frozen-lockfile

- name: Build and upload prebuilt binary
working-directory: /tmp/beamcoder
run: |
npm run prebuild
npx prebuild --upload ${{ secrets.GITHUB_TOKEN }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

publish-npm:
needs: prebuild
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- run: yarn install --frozen-lockfile
- run: yarn publish
working-directory: /tmp/beamcoder
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
"main": "index.js",
"types": "index.d.ts",
"scripts": {
"preinstall": "node install_ffmpeg_static.js",
"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",
"prebuild": "node install_ffmpeg_static.js && FFMPEG_STATIC=1 prebuild",
"test": "tape test/*.js",
"lint": "eslint **/*.js",
"lint-html": "eslint **/*.js -f html -o ./reports/lint-results.html",
Expand Down Expand Up @@ -37,11 +37,13 @@
},
"homepage": "https://github.com/Streampunk/beamcoder#readme",
"dependencies": {
"bindings": "^1.5.0"
"bindings": "^1.5.0",
"prebuild-install": "^7.1.2"
},
"devDependencies": {
"eslint": "^8.9.0",
"tape": "^5.5.2"
"tape": "^5.5.2",
"prebuild": "^13.0.1"
},
"gypfile": true
}
Loading
Loading