|
99 | 99 | with: |
100 | 100 | name: opencode-cli |
101 | 101 | path: packages/opencode/dist |
102 | | - |
103 | 102 | outputs: |
104 | 103 | version: ${{ needs.version.outputs.version }} |
105 | 104 |
|
@@ -240,11 +239,130 @@ jobs: |
240 | 239 | APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }} |
241 | 240 | APPLE_API_KEY_PATH: ${{ runner.temp }}/apple-api-key.p8 |
242 | 241 |
|
| 242 | + build-electron: |
| 243 | + needs: |
| 244 | + - build-cli |
| 245 | + - version |
| 246 | + continue-on-error: false |
| 247 | + strategy: |
| 248 | + fail-fast: false |
| 249 | + matrix: |
| 250 | + settings: |
| 251 | + - host: macos-latest |
| 252 | + target: x86_64-apple-darwin |
| 253 | + platform_flag: --mac --x64 |
| 254 | + - host: macos-latest |
| 255 | + target: aarch64-apple-darwin |
| 256 | + platform_flag: --mac --arm64 |
| 257 | + - host: "blacksmith-4vcpu-windows-2025" |
| 258 | + target: x86_64-pc-windows-msvc |
| 259 | + platform_flag: --win |
| 260 | + - host: "blacksmith-4vcpu-ubuntu-2404" |
| 261 | + target: x86_64-unknown-linux-gnu |
| 262 | + platform_flag: --linux |
| 263 | + - host: "blacksmith-4vcpu-ubuntu-2404" |
| 264 | + target: aarch64-unknown-linux-gnu |
| 265 | + platform_flag: --linux |
| 266 | + runs-on: ${{ matrix.settings.host }} |
| 267 | + steps: |
| 268 | + - uses: actions/checkout@v3 |
| 269 | + |
| 270 | + - uses: apple-actions/import-codesign-certs@v2 |
| 271 | + if: runner.os == 'macOS' |
| 272 | + with: |
| 273 | + keychain: build |
| 274 | + p12-file-base64: ${{ secrets.APPLE_CERTIFICATE }} |
| 275 | + p12-password: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} |
| 276 | + |
| 277 | + - name: Setup Apple API Key |
| 278 | + if: runner.os == 'macOS' |
| 279 | + run: echo "${{ secrets.APPLE_API_KEY_PATH }}" > $RUNNER_TEMP/apple-api-key.p8 |
| 280 | + |
| 281 | + - uses: ./.github/actions/setup-bun |
| 282 | + |
| 283 | + - uses: actions/setup-node@v4 |
| 284 | + with: |
| 285 | + node-version: "24" |
| 286 | + |
| 287 | + - name: Cache apt packages |
| 288 | + if: contains(matrix.settings.host, 'ubuntu') |
| 289 | + uses: actions/cache@v4 |
| 290 | + with: |
| 291 | + path: ~/apt-cache |
| 292 | + key: ${{ runner.os }}-${{ matrix.settings.target }}-apt-electron-${{ hashFiles('.github/workflows/publish.yml') }} |
| 293 | + restore-keys: | |
| 294 | + ${{ runner.os }}-${{ matrix.settings.target }}-apt-electron- |
| 295 | +
|
| 296 | + - name: Install dependencies (ubuntu only) |
| 297 | + if: contains(matrix.settings.host, 'ubuntu') |
| 298 | + run: | |
| 299 | + mkdir -p ~/apt-cache && chmod -R a+rw ~/apt-cache |
| 300 | + sudo apt-get update |
| 301 | + sudo apt-get install -y --no-install-recommends -o dir::cache::archives="$HOME/apt-cache" rpm |
| 302 | + sudo chmod -R a+rw ~/apt-cache |
| 303 | +
|
| 304 | + - name: Setup git committer |
| 305 | + id: committer |
| 306 | + uses: ./.github/actions/setup-git-committer |
| 307 | + with: |
| 308 | + opencode-app-id: ${{ vars.OPENCODE_APP_ID }} |
| 309 | + opencode-app-secret: ${{ secrets.OPENCODE_APP_SECRET }} |
| 310 | + |
| 311 | + - name: Prepare |
| 312 | + run: bun ./scripts/prepare.ts |
| 313 | + working-directory: packages/desktop-electron |
| 314 | + env: |
| 315 | + OPENCODE_VERSION: ${{ needs.version.outputs.version }} |
| 316 | + OPENCODE_CHANNEL: ${{ (github.ref_name == 'beta' && 'beta') || 'prod' }} |
| 317 | + RUST_TARGET: ${{ matrix.settings.target }} |
| 318 | + GH_TOKEN: ${{ github.token }} |
| 319 | + GITHUB_RUN_ID: ${{ github.run_id }} |
| 320 | + |
| 321 | + - name: Build |
| 322 | + run: bun run build |
| 323 | + working-directory: packages/desktop-electron |
| 324 | + env: |
| 325 | + OPENCODE_CHANNEL: ${{ (github.ref_name == 'beta' && 'beta') || 'prod' }} |
| 326 | + |
| 327 | + - name: Package and publish |
| 328 | + if: needs.version.outputs.release |
| 329 | + run: npx electron-builder ${{ matrix.settings.platform_flag }} --publish always --config electron-builder.config.ts |
| 330 | + working-directory: packages/desktop-electron |
| 331 | + timeout-minutes: 60 |
| 332 | + env: |
| 333 | + OPENCODE_CHANNEL: ${{ (github.ref_name == 'beta' && 'beta') || 'prod' }} |
| 334 | + GH_TOKEN: ${{ steps.committer.outputs.token }} |
| 335 | + CSC_LINK: ${{ secrets.APPLE_CERTIFICATE }} |
| 336 | + CSC_KEY_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} |
| 337 | + APPLE_API_KEY: ${{ runner.temp }}/apple-api-key.p8 |
| 338 | + APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY }} |
| 339 | + APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }} |
| 340 | + |
| 341 | + - name: Package (no publish) |
| 342 | + if: ${{ !needs.version.outputs.release }} |
| 343 | + run: npx electron-builder ${{ matrix.settings.platform_flag }} --publish never --config electron-builder.config.ts |
| 344 | + working-directory: packages/desktop-electron |
| 345 | + timeout-minutes: 60 |
| 346 | + env: |
| 347 | + OPENCODE_CHANNEL: ${{ (github.ref_name == 'beta' && 'beta') || 'prod' }} |
| 348 | + |
| 349 | + - uses: actions/upload-artifact@v4 |
| 350 | + with: |
| 351 | + name: opencode-electron-${{ matrix.settings.target }} |
| 352 | + path: packages/desktop-electron/dist/* |
| 353 | + |
| 354 | + - uses: actions/upload-artifact@v4 |
| 355 | + if: needs.version.outputs.release |
| 356 | + with: |
| 357 | + name: latest-yml-${{ matrix.settings.target }} |
| 358 | + path: packages/desktop-electron/dist/latest*.yml |
| 359 | + |
243 | 360 | publish: |
244 | 361 | needs: |
245 | 362 | - version |
246 | 363 | - build-cli |
247 | 364 | - build-tauri |
| 365 | + - build-electron |
248 | 366 | runs-on: blacksmith-4vcpu-ubuntu-2404 |
249 | 367 | steps: |
250 | 368 | - uses: actions/checkout@v3 |
@@ -281,6 +399,12 @@ jobs: |
281 | 399 | name: opencode-cli |
282 | 400 | path: packages/opencode/dist |
283 | 401 |
|
| 402 | + - uses: actions/download-artifact@v4 |
| 403 | + if: needs.version.outputs.release |
| 404 | + with: |
| 405 | + pattern: latest-yml-* |
| 406 | + path: /tmp/latest-yml |
| 407 | + |
284 | 408 | - name: Cache apt packages (AUR) |
285 | 409 | uses: actions/cache@v4 |
286 | 410 | with: |
@@ -308,3 +432,4 @@ jobs: |
308 | 432 | GITHUB_TOKEN: ${{ steps.committer.outputs.token }} |
309 | 433 | GH_REPO: ${{ needs.version.outputs.repo }} |
310 | 434 | NPM_CONFIG_PROVENANCE: false |
| 435 | + LATEST_YML_DIR: /tmp/latest-yml |
0 commit comments