Skip to content

Add auto-release workflow for patch/dev merges into main - #4

Merged
fboundy merged 1 commit into
mainfrom
release-workflow
Jul 3, 2026
Merged

fboundy merged 1 commit into
mainfrom
release-workflow

Conversation

@fboundy

@fboundy fboundy commented Jul 3, 2026

Copy link
Copy Markdown
Owner

Summary

  • New trigger on .github/workflows/release.yaml: when a PR into main is merged, bump the version in manifest.json and cut a GitHub release automatically.
    • Merged from patch → bump PATCH (X.Y.Z → X.Y.Z+1).
    • Merged from dev → bump MINOR and reset PATCH (X.Y.Z → X.Y+1.0).
    • Any other source branch (docs branches, one-off fixes, etc.) → no release, silently skipped.
  • workflow_dispatch still works for a manual release, now with an explicit bump choice input (patch/minor/major) instead of the old "bump patch if not already higher than the latest tag" heuristic.
  • Fixed COMPONENT_NAME — it was still solis_modbus from before the rebrand, so every step (manifest path, zip, release asset) was pointing at a path that no longer exists.
  • Branch-name values from PR context are passed via env:, not interpolated directly into shell scripts, to avoid script injection from an attacker-controlled branch name on a fork PR.

Required follow-up (cannot be done by this PR)

This workflow needs a repo secret named PAT — a personal access token from an account with bypass rights on the protected main branch (contents:write scope is enough). It's needed because:

  • main requires PRs (branch protection), so only a PAT-authenticated push from an admin account can land the version-bump commit directly.
  • A push using the default GITHUB_TOKEN does not trigger other workflows, so the bump commit's required status checks (validate-hacs, validate, test) would never run if we used it instead.

Without this secret, the workflow will fail at the "Commit and push version bump" step. The old manual release.yaml already referenced secrets.PAT but it was never configured, so this isn't a new gap — just now made explicit.

Test plan

  • YAML validated with PyYAML (yaml.safe_load) — no actionlint available locally.
  • Not yet exercised end-to-end (needs the PAT secret + an actual patch/dev merge to verify).

🤖 Generated with Claude Code

Adds a pull_request(closed) trigger: merging a PR from branch `patch`
bumps the manifest PATCH version, merging from `dev` bumps MINOR and
resets PATCH to 0. Any other source branch is a no-op (workflow_dispatch
remains available for manual releases with a bump-type input).

Also fixes COMPONENT_NAME (was still "solis_modbus" from before the
rebrand, which would have made every step operate on a nonexistent
path).

Requires a repo secret named PAT (a personal access token from an
account with bypass rights on the protected main branch) for both the
version-bump push and the release upload — main requires PRs, and only
a PAT-authenticated push (not the default GITHUB_TOKEN) will trigger
this branch's required status checks on the bump commit.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Failed to generate code suggestions for PR

@fboundy
fboundy merged commit c642da5 into main Jul 3, 2026
6 checks passed
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