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