55# LeXwDeX/opencode fork. Stripped-down version of upstream
66# publish.yml — removes repo guard, Blacksmith runners, code
77# signing, npm publish, and Tauri desktop.
8- # Trigger : Manual workflow_dispatch (PRIMARY) — pick branch + version
8+ # Trigger : Manual workflow_dispatch (PRIMARY) — pick main or dev
99# Push to main/dev ONLY registers the workflow in the Actions UI
1010# (the build job is gated on `github.event_name == 'workflow_dispatch'`)
11- # Inputs : version — release version string (e.g. "1.14.30-fork.2")
12- # Leave blank for auto timestamped version.
13- # create_release — when true, create a GitHub Release with the
11+ # Version : Independent GraphAgent SemVer derived only from graphagent-v* tags.
12+ # dev builds the next stable version as X.Y.Z-dev.N; main publishes
13+ # X.Y.Z and marks it Latest. OpenCode package versions are ignored.
14+ # Inputs : create_release — when true, create a GitHub Release with the
1415# built binaries + SHA256SUMS attached. Builds
15- # from any branch other than `main ` are marked
16- # prerelease (test build); `main` = formal release .
16+ # from `dev ` are marked prerelease (test build);
17+ # `main` builds are formal and become Latest .
1718# platforms — comma-separated subset of linux,macos,windows
1819# to build. Leave blank to build all three.
1920# Jobs : package-templates — package latest reference templates from the
3132 # Manual trigger — the primary way to build releases
3233 workflow_dispatch :
3334 inputs :
34- version :
35- description : " Release version (e.g. 1.14.30-fork.2). Leave blank for auto."
36- required : false
37- type : string
3835 create_release :
3936 description : " Create a GitHub Release with the built binaries"
4037 required : false
4138 type : boolean
42- default : false
39+ default : true
4340 platforms :
4441 description : " Platforms to build, comma-separated (linux,macos,windows). Leave blank for all."
4542 required : false
@@ -58,7 +55,36 @@ permissions:
5855env :
5956 FORCE_JAVASCRIPT_ACTIONS_TO_NODE24 : false
6057
58+ concurrency :
59+ group : release-fork
60+ cancel-in-progress : false
61+
6162jobs :
63+ version :
64+ name : Resolve GraphAgent Version
65+ if : github.event_name == 'workflow_dispatch'
66+ runs-on : ubuntu-latest
67+ outputs :
68+ channel : ${{ steps.release-version.outputs.channel }}
69+ version : ${{ steps.release-version.outputs.version }}
70+ tag : ${{ steps.release-version.outputs.tag }}
71+ prerelease : ${{ steps.release-version.outputs.prerelease }}
72+ latest : ${{ steps.release-version.outputs.latest }}
73+ steps :
74+ - name : Checkout Repository
75+ uses : actions/checkout@v4
76+ with :
77+ fetch-depth : 0
78+
79+ - name : Setup Bun
80+ uses : ./.github/actions/setup-bun
81+ with :
82+ save-cache : false
83+
84+ - name : Resolve Version
85+ id : release-version
86+ run : bun run ./packages/opencode/script/release-version.ts
87+
6288 # Package the latest reference templates from the dedicated config repo
6389 # (LeXwDeX/opencode-dag-config) into a release asset. dev/main do not manage
6490 # these templates anymore — the config repo is the single source of truth.
98124
99125 build-cli :
100126 name : Build CLI (${{ matrix.name }})
101- needs : package-templates
127+ needs : [version, package-templates]
102128 # Skip the actual build when triggered by push (registration-only). Per-
103129 # matrix-entry platform filtering can't live here — `matrix` isn't in
104130 # scope for a job-level `if:` — so it's applied to each step below instead.
@@ -182,8 +208,8 @@ jobs:
182208 if : inputs.platforms == '' || contains(inputs.platforms, matrix.name)
183209 run : ./packages/opencode/script/build.ts --single --skip-install
184210 env :
185- OPENCODE_CHANNEL : latest
186- OPENCODE_VERSION : ${{ inputs .version || '' }}
211+ OPENCODE_CHANNEL : ${{ needs.version.outputs.channel == 'main' && ' latest' || 'dev' }}
212+ OPENCODE_VERSION : ${{ needs .version.outputs.version }}
187213
188214 # Bundle ripgrep into each dist/opencode-*/bin so air-gapped users do not
189215 # hit the runtime download in packages/core/src/ripgrep/binary.ts.
@@ -221,7 +247,7 @@ jobs:
221247
222248 release :
223249 name : Create GitHub Release
224- needs : [build-cli, package-templates]
250+ needs : [version, build-cli, package-templates]
225251 if : inputs.create_release
226252 runs-on : ubuntu-latest
227253 steps :
@@ -234,16 +260,6 @@ jobs:
234260 path : release-assets
235261 merge-multiple : true
236262
237- - name : Determine Version Tag
238- id : tag
239- run : |
240- VER="${{ inputs.version }}"
241- if [ -z "$VER" ]; then
242- VER="0.0.0-$(date +%Y%m%d%H%M)"
243- fi
244- echo "version=$VER" >> "$GITHUB_OUTPUT"
245- echo "tag=v$VER" >> "$GITHUB_OUTPUT"
246-
247263 - name : Generate SHA256SUMS
248264 working-directory : release-assets
249265 run : |
@@ -254,17 +270,18 @@ jobs:
254270 - name : Create GitHub Release
255271 env :
256272 GH_TOKEN : ${{ github.token }}
257- # Releases built from any branch other than `main` (e.g. `dev`) are
258- # test builds and get marked --prerelease; only `main` produces a
259- # formal release.
273+ # dev releases are prereleases and can never become Latest. main
274+ # releases are formal and are explicitly promoted to Latest.
260275 run : |
261276 EXTRA_FLAGS=()
262- if [ "${{ github.ref_name }}" != "main" ]; then
263- EXTRA_FLAGS+=(--prerelease)
277+ if [ "${{ needs.version.outputs.channel }}" = "main" ]; then
278+ EXTRA_FLAGS+=(--latest)
279+ else
280+ EXTRA_FLAGS+=(--prerelease --latest=false)
264281 fi
265- gh release create "${{ steps.tag .outputs.tag }}" \
266- --title "opencode ${{ steps.tag .outputs.version }}" \
267- --notes "Fork release from branch ${{ github.ref_name }}" \
282+ gh release create "${{ needs.version .outputs.tag }}" \
283+ --title "OpenCode GraphAgent v ${{ needs.version .outputs.version }}" \
284+ --notes "GraphAgent release from branch ${{ github.ref_name }}" \
268285 --target "${{ github.sha }}" \
269286 "${EXTRA_FLAGS[@]}" \
270287 release-assets/*
0 commit comments