Skip to content

Commit 26598be

Browse files
author
zhiyuanlei
committed
fix(ci): switch to crx package for reliable CRX building
1 parent 3d1b9a5 commit 26598be

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

.github/workflows/release.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,20 @@ jobs:
2323

2424
- name: Build CRX
2525
run: |
26-
zip -r extension.zip . -x '.git/*' '.github/*' 'key.pem' '*.crx' '*.zip'
27-
npm install crx3
28-
npx crx3 extension.zip -p key.pem -o opencode-reader.crx
29-
rm -f extension.zip
26+
npm install crx
27+
node -e "
28+
const fs = require('fs');
29+
const path = require('path');
30+
const ChromeExtension = require('crx');
31+
const crx = new ChromeExtension({ privateKey: fs.readFileSync('key.pem') });
32+
crx.load(path.resolve('.'))
33+
.then(crx => crx.pack())
34+
.then(buf => {
35+
fs.writeFileSync('opencode-reader.crx', buf);
36+
console.log('CRX built successfully');
37+
})
38+
.catch(e => { console.error(e); process.exit(1); });
39+
"
3040
3141
- name: Clean up key
3242
run: rm -f key.pem

0 commit comments

Comments
 (0)