3535 with :
3636 submodules : true
3737
38- - uses : oven-sh/setup-bun@v2
39- with :
40- bun-version : latest
41-
4238 - uses : actions/setup-node@v4
4339 with :
4440 node-version : 20
@@ -47,28 +43,55 @@ jobs:
4743 run : npm ci
4844
4945 - name : Install proxy dependencies
50- run : cd copilot-proxy && bun install
46+ run : cd copilot-proxy && npm install --ignore-scripts --no-package-lock
5147
5248 - name : Generate icons
5349 run : node scripts/generate-icons.cjs
5450
5551 - name : Build frontend
5652 run : npx vite build
5753
58- - name : Build proxy server
59- shell : bash
60- run : |
61- mkdir -p build
62- bun build --compile --target=bun-windows-x64 copilot-proxy/src/main.ts --outfile build/copilot-proxy-server.exe
54+ - name : Bundle proxy server (JS)
55+ run : node scripts/bundle-proxy.cjs
6356
6457 - name : Package with electron-builder
6558 run : npx electron-builder --win --config electron-builder.yml
6659
60+ - name : Generate update manifest
61+ run : |
62+ node -e "
63+ const fs = require('fs');
64+ const path = require('path');
65+ const crypto = require('crypto');
66+ const sha256 = f => crypto.createHash('sha256').update(fs.readFileSync(f)).digest('hex');
67+ const asarPath = path.join('release', 'win-unpacked', 'resources', 'app.asar');
68+ const bundlePath = path.join('build', 'copilot-proxy-bundle.mjs');
69+ if (!fs.existsSync(asarPath) || !fs.existsSync(bundlePath)) { console.error('Missing assets'); process.exit(1); }
70+ const pkg = require('./package.json');
71+ const ePkg = require('./node_modules/electron/package.json');
72+ const manifest = {
73+ version: pkg.version,
74+ minElectronVersion: ePkg.version.split('.')[0] + '.0.0',
75+ assets: {
76+ 'app.asar': { size: fs.statSync(asarPath).size, sha256: sha256(asarPath) },
77+ 'copilot-proxy-bundle.mjs': { size: fs.statSync(bundlePath).size, sha256: sha256(bundlePath) },
78+ },
79+ };
80+ fs.writeFileSync('release/update-manifest.json', JSON.stringify(manifest, null, 2));
81+ fs.copyFileSync(asarPath, 'release/app.asar');
82+ fs.copyFileSync(bundlePath, 'release/copilot-proxy-bundle.mjs');
83+ console.log(JSON.stringify(manifest, null, 2));
84+ "
85+
6786 - name : Upload to GitHub Release
6887 if : startsWith(github.ref, 'refs/tags/')
6988 uses : softprops/action-gh-release@v2
7089 with :
71- files : release/*.exe
90+ files : |
91+ release/*.exe
92+ release/update-manifest.json
93+ release/app.asar
94+ release/copilot-proxy-bundle.mjs
7295 env :
7396 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
7497
@@ -92,10 +115,6 @@ jobs:
92115 with :
93116 submodules : true
94117
95- - uses : oven-sh/setup-bun@v2
96- with :
97- bun-version : latest
98-
99118 - uses : actions/setup-node@v4
100119 with :
101120 node-version : 20
@@ -104,23 +123,16 @@ jobs:
104123 run : npm ci
105124
106125 - name : Install proxy dependencies
107- run : cd copilot-proxy && bun install
126+ run : cd copilot-proxy && npm install --ignore-scripts --no-package-lock
108127
109128 - name : Generate icons
110129 run : node scripts/generate-icons.cjs
111130
112131 - name : Build frontend
113132 run : npx vite build
114133
115- - name : Build proxy server
116- run : |
117- mkdir -p build
118- if [ "${{ matrix.arch }}" = "arm64" ]; then
119- bun build --compile --target=bun-darwin-arm64 copilot-proxy/src/main.ts --outfile build/copilot-proxy-server
120- else
121- bun build --compile --target=bun-darwin-x64 copilot-proxy/src/main.ts --outfile build/copilot-proxy-server
122- fi
123- chmod +x build/copilot-proxy-server
134+ - name : Bundle proxy server (JS)
135+ run : node scripts/bundle-proxy.cjs
124136
125137 - name : Package with electron-builder
126138 run : npx electron-builder --mac --${{ matrix.arch }} --config electron-builder.yml
0 commit comments