Files
shopify-ai-backup/.github/workflows/build-opencode-cli-docker.yml
southseact-3d e8f89ae111 Simplify workflow: build CLI only in GitHub Actions, image built by Portainer
- Removed Docker build job from workflow (image built when deploying)
- Updated paths filter to only trigger on opencode/** changes
- Added artifact cleanup to keep only latest CLI build
- Added multi-stage Dockerfile to build CLI from source during Docker build
- Simplified permissions (removed packages write)
2026-02-10 13:44:03 +00:00

67 lines
1.8 KiB
YAML

name: Build OpenCode CLI
on:
push:
branches:
- main
- master
paths:
- opencode/**
workflow_dispatch:
permissions:
contents: read
actions: read
jobs:
build-cli:
name: Build OpenCode CLI (x86_64)
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version-file: opencode/package.json
- name: Install dependencies
run: bun install
working-directory: opencode
- name: Build CLI
run: bun run ./packages/opencode/script/build.ts --single
working-directory: opencode
- name: Upload CLI artifact
uses: actions/upload-artifact@v4
with:
name: opencode-cli-x86_64
path: opencode/packages/opencode/dist/opencode-linux-x64
retention-days: 1
- name: Cleanup old CLI artifacts
uses: actions/github-script@v7
with:
script: |
const artifactName = 'opencode-cli-x86_64';
const { data: artifacts } = await github.rest.actions.listArtifactsForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
name: artifactName,
per_page: 10
});
if (artifacts.length > 1) {
const artifactsToDelete = artifacts.slice(1);
for (const artifact of artifactsToDelete) {
await github.rest.actions.deleteArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: artifact.id
});
console.log(`Deleted old artifact: ${artifact.id}`);
}
}