@lumen5/beamcoder 0.0.4 → 0.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,118 @@
1
+ # Build prebuilt binaries and publish to npm
2
+ name: Build & Publish
3
+
4
+ on:
5
+ push:
6
+ # branches: [main]
7
+ pull_request:
8
+ branches: [main]
9
+ workflow_dispatch:
10
+
11
+ jobs:
12
+ prebuild:
13
+ strategy:
14
+ matrix:
15
+ include:
16
+ - os: ubuntu-latest
17
+ platform: linux
18
+ - os: macos-14
19
+ platform: darwin
20
+ runs-on: ${{ matrix.os }}
21
+ steps:
22
+ - uses: actions/checkout@v3
23
+
24
+ - uses: actions/setup-node@v3
25
+ with:
26
+ node-version: 22
27
+
28
+ - name: Get package version
29
+ id: version
30
+ run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
31
+
32
+ - name: Install system dependencies (Linux)
33
+ if: matrix.platform == 'linux'
34
+ run: sudo apt-get update && sudo apt-get install -y libvpx-dev
35
+
36
+ - name: Install system dependencies (macOS)
37
+ if: matrix.platform == 'darwin'
38
+ run: brew install libvpx
39
+
40
+ - name: Install dependencies (skip native build)
41
+ run: yarn install --frozen-lockfile --ignore-scripts
42
+
43
+ - name: Download FFmpeg static libraries
44
+ run: node install_ffmpeg_static.js
45
+
46
+ - name: Build prebuild
47
+ run: npx prebuild --strip -r node -t 22.0.0
48
+ env:
49
+ FFMPEG_STATIC: "1"
50
+
51
+ - name: List prebuilds
52
+ run: find prebuilds -name "*.tar.gz" -ls
53
+
54
+ - name: Upload prebuild artifact
55
+ uses: actions/upload-artifact@v4
56
+ with:
57
+ name: prebuild-${{ matrix.platform }}
58
+ path: prebuilds/**/*.tar.gz
59
+
60
+ release:
61
+ needs: prebuild
62
+ runs-on: ubuntu-latest
63
+ steps:
64
+ - uses: actions/checkout@v3
65
+
66
+ - uses: actions/setup-node@v3
67
+ with:
68
+ node-version: 22
69
+ registry-url: https://registry.npmjs.org/
70
+
71
+ - name: Get package version
72
+ id: version
73
+ run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
74
+
75
+ - name: Download all prebuild artifacts
76
+ uses: actions/download-artifact@v4
77
+ with:
78
+ path: prebuilds
79
+ pattern: prebuild-*
80
+ merge-multiple: true
81
+
82
+ - name: List all prebuilds
83
+ run: find prebuilds -name "*.tar.gz" -ls
84
+
85
+ - name: Create or update release
86
+ # if: github.ref == 'refs/heads/main'
87
+ run: |
88
+ VERSION="v${{ steps.version.outputs.version }}"
89
+ # Check if release exists
90
+ if gh release view "$VERSION" >/dev/null 2>&1; then
91
+ echo "Release $VERSION exists, uploading prebuilds..."
92
+ else
93
+ echo "Creating release $VERSION..."
94
+ gh release create "$VERSION" --title "$VERSION" --notes "Prebuilt binaries for version $VERSION"
95
+ fi
96
+ # Upload prebuilds
97
+ find prebuilds -name "*.tar.gz" -exec gh release upload "$VERSION" {} --clobber \;
98
+ env:
99
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
100
+
101
+ - name: Install system dependencies
102
+ run: sudo apt-get update && sudo apt-get install -y libvpx-dev
103
+
104
+ - name: Install dependencies (skip native build)
105
+ run: yarn install --frozen-lockfile --ignore-scripts
106
+
107
+ - name: Download FFmpeg static libraries
108
+ run: node install_ffmpeg_static.js
109
+
110
+ - name: Build for npm publish
111
+ # if: github.ref == 'refs/heads/main'
112
+ run: FFMPEG_STATIC=1 npx node-gyp rebuild
113
+
114
+ - name: Publish to npm
115
+ # if: github.ref == 'refs/heads/main'
116
+ run: npm publish
117
+ env:
118
+ NODE_AUTH_TOKEN: ${{ secrets.npm_token }}
package/package.json CHANGED
@@ -1,15 +1,16 @@
1
1
  {
2
2
  "name": "@lumen5/beamcoder",
3
- "version": "0.0.4",
3
+ "version": "0.0.13",
4
4
  "description": "Node.js native bindings to FFmpeg.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
7
7
  "scripts": {
8
8
  "preinstall": "node install_ffmpeg_static.js",
9
- "install": "FFMPEG_STATIC=1 node-gyp rebuild",
9
+ "install": "prebuild-install || (FFMPEG_STATIC=1 node-gyp rebuild)",
10
10
  "preinstall:dynamic": "node install_ffmpeg.js",
11
11
  "install:dynamic": "FFMPEG_STATIC=0 node-gyp rebuild",
12
12
  "build:dynamic": "npm run preinstall:dynamic && npm run install:dynamic",
13
+ "prebuild": "FFMPEG_STATIC=1 prebuild --strip",
13
14
  "test": "tape test/*.js",
14
15
  "lint": "eslint **/*.js",
15
16
  "lint-html": "eslint **/*.js -f html -o ./reports/lint-results.html",
@@ -17,7 +18,7 @@
17
18
  },
18
19
  "repository": {
19
20
  "type": "git",
20
- "url": "git+https://github.com/Streampunk/beamcoder.git"
21
+ "url": "git+https://github.com/Lumen5/beamcoder.git"
21
22
  },
22
23
  "keywords": [
23
24
  "FFmpeg",
@@ -37,10 +38,12 @@
37
38
  },
38
39
  "homepage": "https://github.com/Streampunk/beamcoder#readme",
39
40
  "dependencies": {
40
- "bindings": "^1.5.0"
41
+ "bindings": "^1.5.0",
42
+ "prebuild-install": "^7.1.0"
41
43
  },
42
44
  "devDependencies": {
43
45
  "eslint": "^8.9.0",
46
+ "prebuild": "^13.0.0",
44
47
  "tape": "^5.5.2"
45
48
  },
46
49
  "gypfile": true
@@ -1,32 +0,0 @@
1
- # This workflow will publish npm package on release
2
- # For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
3
-
4
- name: Node.js Package
5
-
6
- on:
7
- release:
8
- types: [created]
9
-
10
- jobs:
11
- publish-npm:
12
- runs-on: ubuntu-latest
13
- env:
14
- CPATH: /tmp/beamcoder/.ffmpeg/ffmpeg/include/
15
- PKG_CONFIG_PATH: /tmp/beamcoder/.ffmpeg/ffmpeg/lib/pkgconfig/
16
- steps:
17
- - uses: actions/checkout@v3
18
- - uses: actions/setup-node@v3
19
- with:
20
- node-version: 20
21
- registry-url: https://registry.npmjs.org/
22
- - run: mkdir /tmp/beamcoder
23
- - run: cp -r . /tmp/beamcoder
24
- - run: sudo apt-get update && sudo apt-get install -y libvpx-dev
25
- - run: sudo ./scripts/install_beamcoder_dependencies.sh
26
- working-directory: /tmp/beamcoder
27
- - run: yarn install --frozen-lockfile
28
- working-directory: /tmp/beamcoder
29
- - run: yarn publish
30
- working-directory: /tmp/beamcoder
31
- env:
32
- NODE_AUTH_TOKEN: ${{secrets.npm_token}}