Skip to content

feat(ci): one-click release workflow - #443

Merged
ranxianglei merged 2 commits into
masterfrom
2026-09-20_one-click-release
Sep 20, 2026
Merged

ranxianglei merged 2 commits into
masterfrom
2026-09-20_one-click-release

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

What

Port of the one-click release workflow from billion-context (origin: ranxianglei/billion-context#772, built as #944 + #978 green-on-prepared fallback + #994 generated changelog body + #1017 stale-branch collision fix). New file only: .github/workflows/release-manual.yml — no product code touched.

Usage: Actions tab → Release (one-click) → Run workflow. version input blank = auto next-patch over npm latest; type an explicit semver for minor/major/prerelease.

Flow

  1. Resolve version (auto or explicit)
  2. Drift guard — master package.json must equal npm latest, else abort loudly
  3. Bump ONLY package.json + package-lock.json; verify the diff touches exactly those two files
  4. Full pre-flight gate (mirrors this repo's own release.yml gate)
  5. Commit release v{V}: direct push to master if allowed → same run continues to publish + tag + GitHub Release; if branch protection blocks it → release prepared on a YYYY-MM-DD_release-v{V} branch (timestamp suffix on name collision), best-effort auto-PR with a generated changelog, run stays GREEN with the PR link in the job summary (one-click /pull/new link if auto-PR is blocked by the account-level Actions restriction)
  6. Human merges the release PR → this repo's existing release.yml detects the date-prefixed release-branch merge and publishes via CI.

Adaptation notes

  • Pre-flight gate mirrors this repo's release.yml exactly: npm ci + npm run check:package + npm test (no separate build step), setup-node with cache: npm like the existing workflows.
  • The existing workflow_dispatch (force input) on release.yml is untouched; this is a separate workflow named "Release (one-click)" so both show up distinctly in the Actions dropdown.
  • Auto-bump starts from npm latest (the stable lane), which is correct for this repo's dev/stable tag model.

Verified locally

  • pyyaml parse OK (13 steps); every run: script passes bash -n
  • zero hardcoded references to another repo's package name (npm view target is read dynamically from package.json)
  • master currently matches npm latest, so the drift guard will not trip on first use

Note

Merge the generated release PR with a standard merge commit (the default button) — squash/rebase would drop the date-prefixed branch name from the commit message and release.yml would skip publishing. Same convention the repo already uses for manual releases.

@github-actions

github-actions Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Plugin Artifact

Branch: 2026-09-20_one-click-release (241a3a9)

Option A — Install from npm PR tag (recommended)

opencode plugin opencode-acp@pr-443 --global

Each push to this PR publishes a new version under the pr-443 npm tag.

Option B — Install from GitHub

opencode plugin "github:ranxianglei/opencode-acp#2026-09-20_one-click-release" --global

Option C — Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf opencode-acp-pr443.tgz
cp -r package/dist ~/.cache/opencode/packages/opencode-acp@latest/node_modules/opencode-acp/dist
  1. Restart opencode to pick up changes.

This comment is automatically updated on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 Verified this PR and fixed the one thing blocking it. PR #443 is ready for human merge once CI goes green (re-running now after my fix).

Code verification (branch 2026-09-20_one-click-release, 1510f154)

Diff is exactly what the issue describes — 1 new file, .github/workflows/release-manual.yml (+263), zero product code. Checked against the claims:

  • ✅ YAML parses (pyyaml), 13 steps; every inline run: block passes bash -n
  • ✅ Pre-flight gate mirrors release.yml exactly: npm ci → npm run check:package → npm test, with setup-node@v4 node 22 + cache: npm + npmjs registry
  • ✅ No hardcoded package name — npm target read dynamically via node -p "require('./package.json').name" (both auto-bump and drift guard)
  • ✅ Fallback branch name YYYY-MM-DD_release-v{V} matches release.yml's Pattern-1 detection regex; -HHMMSS suffix on stale same-day collision (the #1017 port)
  • ✅ Generated changelog uses git log --no-merges LAST_TAG..HEAD~1 — correctly excludes the release commit itself
  • ✅ Prerelease handling mirrors release.yml (- in version → npm tag dev + prerelease: true)
  • ✅ Existing release.yml untouched; concurrency group prevents overlapping runs

Two minor observations (non-blocking, noted for the record):

  1. "Verify bump diff" stages exactly the two files it then checks, so it proves they changed rather than proving nothing else could change — the real guarantee is that the bump script only writes those two files. Fine as-is.
  2. The bump string-replaces "version": "<old>" in package-lock.json; if a dependency ever happened to carry the identical version string it would be bumped too. Not the case today (lockfile checked); theoretical edge.

What was broken and what I fixed

pr-validation was failing — job log confirms exactly 2 failures and nothing else:

✗ devlog/2026-09-20_one-click-release/REQ.md is missing (required by AGENTS.md Section 5.1.2)
✗ devlog/2026-09-20_one-click-release/WORKLOG.md is missing

The PR shipped without its mandatory devlog entry (AGENTS.md §5.1.2 / scripts/ci/check-pr.sh). Fixed directly on the PR branch: added devlog/2026-09-20_one-click-release/REQ.md + WORKLOG.md documenting the workflow (flow, constraints, verification results, risk/rollback) — commit 241a3a95. Local check-pr.sh now passes all checks; product test jobs were already green.

I'll follow up here when the re-run finishes.

When merging

Per the issue Note: use the standard merge commit button (not squash/rebase) on any generated release PR — otherwise release.yml won't detect the date-prefixed branch name in the merge title and will skip publishing. This PR itself can be merged either way (it's not a release PR).

中文摘要:验证了工作流文件与描述一致且全部静态检查通过;CI 失败原因是 PR 缺少 AGENTS.md 要求的 devlog 条目(REQ.md/WORKLOG.md),已在 PR 分支补上(commit 241a3a9),等 CI 复跑全绿后即可由人工合并。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 CI re-run on 241a3a95 is fully green — all checks pass on the head commit:

Check Result
pr-validation ✅ success (was failing — fixed by the devlog entry)
build-artifact ✅ success
test (22) / test (24) ✅ success
build ✅ success
e2e ✅ success

PR state is now mergeable_state: clean (was blocked). Final diff: .github/workflows/release-manual.yml (+263) + devlog/2026-09-20_one-click-release/{REQ.md,WORKLOG.md} — nothing else.

Nothing left on my side. Ready for you to merge whenever — and when you do this PR, either merge style works; just remember the standard merge commit rule for the generated release PRs produced by the new workflow itself (squash/rebase there would make release.yml skip publishing).

中文摘要:补齐缺失的 devlog 条目后 CI 复跑全部通过(pr-validation/build/test/e2e 全绿),PR 已可合并,请人工合并。

@ranxianglei
ranxianglei merged commit 2cdce3f into master Sep 20, 2026
6 checks passed
@ranxianglei ranxianglei mentioned this pull request Sep 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant