Skip to content

Commit

Permalink
chore: add sea scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbyg603 committed Jul 2, 2024
1 parent d41a905 commit 61e32d3
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 18 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/pkg.yaml → .github/workflows/sea.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Package Builds
name: Single Executable Application

on:
push:
Expand All @@ -14,14 +14,14 @@ jobs:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: ubuntu-latest
run_script: pkg:linux
run_script: sea:linux
artifact_name: symbol-upload-linux
- os: macos-latest
run_script: pkg:macos
run_script: sea:macos
artifact_name: symbol-upload-macos
- os: windows-latest
run_script: pkg:windows
artifact_name: symbol-upload-win
run_script: sea:windows
artifact_name: symbol-upload-win.exe

steps:
- name: ☑️ Checkout
Expand All @@ -30,7 +30,7 @@ jobs:
- name: ⚙️ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '22'

- name: 🏗️ Install Dependencies
run: npm ci
Expand All @@ -42,4 +42,4 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: pkg/* # Uploads the artifact with a platform-specific name and path
path: dist/${{ matrix.artifact_name }} # Uploads the artifact with a platform-specific name and path
2 changes: 0 additions & 2 deletions bin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ import { importNodeDumpSyms } from './preload';

if (dumpSyms) {
try {
// @ts-ignore: Cannot find module
const nodeDumpSyms = (await importNodeDumpSyms()).dumpSyms;
symbolFilePaths = symbolFilePaths.map(file => {
console.log(`Dumping syms for ${file}...`);
Expand All @@ -119,7 +118,6 @@ import { importNodeDumpSyms } from './preload';
return symFile;
});
} catch (cause) {
console.error(cause); // TODO BG remove
throw new Error('Can\'t run dump_syms! Please ensure node-dump-syms is installed https://github.com/BugSplat-Git/node-dump-syms', { cause });
}
}
Expand Down
17 changes: 8 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,16 @@
"clean": "rimraf ./dist",
"prebuild": "npm run clean",
"build": "tsc",
"prebundle": "npm run clean",
"bundle": "ncc build ./bin/index.ts -o ./dist && bpkg ./src/compression.js ./dist/compression.js",
"prerelease": "npm run build",
"release": "npm publish --access public",
"prepkg:linux": "npm run build",
"pkg:linux": "npx pkg package.json --targets node18-linux-x64 --output ./pkg/symbol-upload-linux",
"prepkg:macos": "npm run bundle && bpkg ./node_modules/node-dump-syms ./dist/node-dump-syms.js",
"pkg:macos": "node --experimental-sea-config sea-config.json && cp $(command -v node) ./dist/symbol-upload && codesign --remove-signature ./dist/symbol-upload && npx postject ./dist/symbol-upload NODE_SEA_BLOB ./dist/sea-prep.blob --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 --macho-segment-name NODE_SEA && codesign --sign - ./dist/symbol-upload",
"prepkg:windows": "npm run build",
"pkg:windows": "npx pkg package.json --targets node18-win-x64 --output ./pkg/symbol-upload-windows",
"act": "act --secret-file .env"
"prebuild:sea": "npm run clean",
"build:sea": "ncc build ./bin/index.ts -o ./dist && bpkg ./src/compression.js ./dist/compression.js && bpkg ./node_modules/node-dump-syms ./dist/node-dump-syms.js",
"presea:macos": "npm run build:sea",
"presea:windows": "npm run build:sea",
"presea:linux": "npm run build:sea",
"sea:macos": "sh ./sea/macos.sh",
"sea:windows": "./sea/windows.ps1",
"sea:linux": "sh ./sea/linux.sh"
},
"repository": {
"type": "git",
Expand Down
5 changes: 5 additions & 0 deletions sea/linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node --experimental-sea-config sea-config.json
cp $(command -v node) ./dist/symbol-upload-linux
# TODO BG remove signature?
npx postject ./dist/symbol-upload-linux NODE_SEA_BLOB ./dist/sea-prep.blob --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2
# TODO BG sign?
5 changes: 5 additions & 0 deletions sea/macos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node --experimental-sea-config sea-config.json
cp $(command -v node) ./dist/symbol-upload-macos
codesign --remove-signature ./dist/symbol-upload-macos
npx postject ./dist/symbol-upload-macos NODE_SEA_BLOB ./dist/sea-prep.blob --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 --macho-segment-name NODE_SEA
codesign --sign - ./dist/symbol-upload-macos
5 changes: 5 additions & 0 deletions sea/windows.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node --experimental-sea-config sea-config.json
node -e "require('fs').copyFileSync(process.execPath, '.\dist\symbol-upload-win.exe')"
signtool remove /s .\dist\symbol-upload-win.exe
npx postject .\dist\symbol-upload-win.exe NODE_SEA_BLOB .\dist\sea-prep.blob --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2
#signtool sign /fd SHA256 symbol-upload-windows.exe

0 comments on commit 61e32d3

Please sign in to comment.