Skip to content

Commit 7a9c36e

Browse files
committed
chore(ci): move fork CI to ci.yml and restore upstream release.yml
1 parent 5e73195 commit 7a9c36e

4 files changed

Lines changed: 833 additions & 47 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
pull_request:
8+
branches: [dev]
9+
types: [opened, synchronize, reopened, ready_for_review]
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
check:
17+
if: ${{ !github.event.pull_request.draft }}
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: read
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
24+
25+
- name: Setup Bun
26+
uses: ./.github/actions/setup-bun
27+
28+
- name: Run checks
29+
run: bun run check
30+
31+
- name: Typecheck (TypeScript 7.1)
32+
run: bun run typecheck:tsc
33+
34+
- name: Run fork tests
35+
run: make tests BUN=bun
36+
37+
release:
38+
if: github.event_name == 'push' && github.repository != 'anomalyco/opencode'
39+
needs: check
40+
runs-on: ubuntu-latest
41+
permissions:
42+
contents: write
43+
steps:
44+
- name: Checkout repository
45+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
46+
47+
- name: Setup Bun
48+
uses: ./.github/actions/setup-bun
49+
50+
- name: Compute version
51+
id: version
52+
run: echo "version=$(date -u +%Y.%-m.%-d)-${GITHUB_SHA:0:7}" >> "$GITHUB_OUTPUT"
53+
54+
- name: Build binaries
55+
run: bun run --cwd packages/cli build
56+
env:
57+
OPENCODE_VERSION: ${{ steps.version.outputs.version }}
58+
OPENCODE_RELEASE: "1"
59+
OPENCODE_CHANNEL: latest
60+
61+
- name: Archive binaries
62+
working-directory: packages/cli/dist
63+
run: |
64+
mkdir -p ../release
65+
for dir in cli-*; do
66+
target="${dir#cli-}"
67+
if [[ "$target" == linux-* ]]; then
68+
tar -czf "../release/opencode-$target.tar.gz" -C "$dir/bin" opencode
69+
else
70+
exe=opencode; [[ "$target" == windows-* ]] && exe=opencode.exe
71+
(cd "$dir/bin" && zip -q "$GITHUB_WORKSPACE/packages/cli/release/opencode-$target.zip" "$exe")
72+
fi
73+
done
74+
75+
- name: Publish release
76+
env:
77+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78+
run: |
79+
tag="v${{ steps.version.outputs.version }}"
80+
gh release view "$tag" >/dev/null 2>&1 || gh release create "$tag" --generate-notes --target "$GITHUB_SHA" --title "$tag" --latest
81+
gh release upload "$tag" packages/cli/release/* --clobber

0 commit comments

Comments
 (0)