Skip to content
This repository was archived by the owner on Aug 17, 2026. It is now read-only.

Commit e33d3a5

Browse files
authored
ci(grunt): release workflow on tag push (v*-grunt.* → GH release binaries) (#4)
Adds .github/workflows/grunt-release.yml. Triggered by push of a tag matching v*-grunt.* OR workflow_dispatch. Builds gruntcode binaries for macOS arm64/x64 + Linux x64/arm64 by: 1. Checking out the tagged ref 2. setup-bun via the existing composite action 3. bun install --frozen-lockfile 4. bun script/build.ts --single --skip-embed-web-ui (leverages upstream build script as-is; --single = current host's target only; --skip-embed-web-ui = drop the embedded web UI to cut binary size and build time since gruntcode is TUI-focused) 5. Rename produced opencode binary → gruntcode 6. tar + sha256 + upload to GH release via softprops/action-gh-release Gated to grunt-it/gruntcode repo so a rebase that pulls upstream workflows can't accidentally fire ours. Also updates GRUNTCODE.md to document the release tag scheme (vX.Y.Z-grunt.N) and the workflow trigger. Refs hivemind anomalyco#222 Phase 4 distribution.
1 parent 52f3a0b commit e33d3a5

2 files changed

Lines changed: 102 additions & 0 deletions

File tree

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: grunt-release
2+
3+
# Builds gruntcode binaries on tag push and publishes a GitHub Release.
4+
#
5+
# Trigger: push a tag matching v*-grunt.* (e.g. v1.15.10-grunt.1) to grunt-it/gruntcode:dev.
6+
# Result: cross-platform binaries (macos arm64/x64, linux x64/arm64) uploaded as
7+
# release assets. Brew formula downloads from there.
8+
#
9+
# This workflow is intentionally minimal — we leverage upstream's
10+
# packages/opencode/script/build.ts for the actual Bun.build invocation +
11+
# rename the produced 'opencode' binary to 'gruntcode' before packaging.
12+
#
13+
# Gating: only runs on grunt-it/gruntcode so a rebase that pulls upstream's
14+
# workflows doesn't accidentally trigger anything ours.
15+
16+
on:
17+
push:
18+
tags:
19+
- "v*-grunt.*"
20+
workflow_dispatch:
21+
inputs:
22+
tag:
23+
description: "Tag to release (must already exist, e.g. v1.15.10-grunt.1)"
24+
required: true
25+
type: string
26+
27+
permissions:
28+
contents: write
29+
30+
jobs:
31+
build:
32+
if: github.repository == 'grunt-it/gruntcode'
33+
strategy:
34+
fail-fast: false
35+
matrix:
36+
include:
37+
- host: macos-14
38+
target_name: gruntcode-darwin-arm64
39+
- host: macos-13
40+
target_name: gruntcode-darwin-x64
41+
- host: ubuntu-24.04
42+
target_name: gruntcode-linux-x64
43+
- host: ubuntu-24.04-arm
44+
target_name: gruntcode-linux-arm64
45+
runs-on: ${{ matrix.host }}
46+
steps:
47+
- uses: actions/checkout@v4
48+
with:
49+
ref: ${{ inputs.tag || github.ref }}
50+
fetch-tags: true
51+
52+
- uses: ./.github/actions/setup-bun
53+
54+
- name: bun install
55+
run: bun install --frozen-lockfile
56+
57+
- name: Build single-target binary
58+
working-directory: packages/opencode
59+
run: bun script/build.ts --single --skip-embed-web-ui
60+
# --single → only build for the current host's platform+arch
61+
# --skip-embed-web-ui → drop the embedded web UI (we're a TUI-focused fork; cuts binary size + build time)
62+
63+
- name: Locate + rename binary
64+
id: locate
65+
working-directory: packages/opencode
66+
run: |
67+
# build.ts writes to dist/<package-name>/bin/opencode where package-name is e.g. opencode-darwin-arm64
68+
binary=$(find dist -name opencode -type f | head -1)
69+
if [ -z "$binary" ]; then
70+
echo "ERROR: no opencode binary produced under dist/. Listing tree:"
71+
find dist -type f | head -40
72+
exit 1
73+
fi
74+
echo "Found binary at: $binary"
75+
# Rename to gruntcode + place at top-level for packaging
76+
cp "$binary" gruntcode
77+
chmod +x gruntcode
78+
./gruntcode --version
79+
echo "binary=$(pwd)/gruntcode" >> $GITHUB_OUTPUT
80+
81+
- name: Package
82+
working-directory: packages/opencode
83+
run: |
84+
tar -czf ${{ matrix.target_name }}.tar.gz gruntcode
85+
shasum -a 256 ${{ matrix.target_name }}.tar.gz | tee ${{ matrix.target_name }}.tar.gz.sha256
86+
87+
- name: Upload to release
88+
uses: softprops/action-gh-release@v2
89+
with:
90+
tag_name: ${{ inputs.tag || github.ref_name }}
91+
files: |
92+
packages/opencode/${{ matrix.target_name }}.tar.gz
93+
packages/opencode/${{ matrix.target_name }}.tar.gz.sha256
94+
fail_on_unmatched_files: true
95+
# Don't overwrite a release body if one was hand-written before pushing the tag
96+
generate_release_notes: true

‎GRUNTCODE.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ bun install
5454
bun run --cwd packages/opencode src/index.ts --help
5555
```
5656

57+
## Releases
58+
59+
Tagged releases live under [grunt-it/gruntcode releases](https://github.com/grunt-it/gruntcode/releases). Tags follow `vX.Y.Z-grunt.N` where `X.Y.Z` is the upstream opencode version we last rebased on, and `N` is the grunt-patch revision against that base.
60+
61+
Pushing a tag matching `v*-grunt.*` to `dev` triggers `.github/workflows/grunt-release.yml`, which builds binaries for macOS arm64/x64 + Linux x64/arm64 and uploads tarballs to the GH release. The homebrew tap formula resolves the latest stable.
62+
5763
## Contributing
5864

5965
For patches that should land in **opencode upstream**: open the PR there directly. We'll see it and drop our equivalent on next rebase.

0 commit comments

Comments
 (0)