fix: auto-create GitHub release on every push to main#3
Conversation
Agent-Logs-Url: https://github.com/Programmercito/switcher-version-tools/sessions/aed1370e-438c-479a-9a2f-38f7b1351e66 Co-authored-by: Programmercito <4504287+Programmercito@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Programmercito/switcher-version-tools/sessions/aed1370e-438c-479a-9a2f-38f7b1351e66 Co-authored-by: Programmercito <4504287+Programmercito@users.noreply.github.com>
Programmercito
left a comment
There was a problem hiding this comment.
El token se llama TOKEN y no github_token
There was a problem hiding this comment.
Pull request overview
Updates the GitHub Actions release workflow so that a GitHub Release (with built binaries) is automatically created on every push to main/master, without requiring a manually-pushed tag.
Changes:
- Removes the tag-only condition/trigger and runs the release job on pushes to
main/master. - Adds full-history checkout plus steps to compute the next
MAJOR.MINORtag and push it. - Updates the release action to use the computed tag and
secrets.GITHUB_TOKEN.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
LATEST_TAG=$(git tag ... | grep ... | head -n1) will fail the step when there are no matching tags because GitHub Actions runs bash with -e and -o pipefail by default; grep exits 1 on no matches, causing the whole pipeline (and the command substitution) to error before the if [ -z "$LATEST_TAG" ] branch can run. Make the pipeline non-fatal when no tags exist (e.g., append || true inside the substitution or otherwise handle the no-match case without relying on grep's exit code).
| LATEST_TAG=$(git tag --sort=-version:refname | grep -E '^[0-9]+\.[0-9]+$' | head -n1) | |
| LATEST_TAG=$(git tag --sort=-version:refname | grep -E '^[0-9]+\.[0-9]+$' | head -n1 || true) |
There was a problem hiding this comment.
Tag creation/push is not concurrency-safe: two runs close together can compute the same next version, then git tag/git push will fail because the tag already exists. Consider adding a concurrency: group for this workflow or making tag selection idempotent (e.g., check remote tags and increment until an unused version is found, or use a unique build identifier).

The release workflow built binaries on every push to
mainbut gated the actual release creation behindif: startsWith(github.ref, 'refs/tags/'), so no release was ever published unless a tag was pushed manually. Additionally,secrets.TOKENis not a built-in secret and may be unset.Changes
if: startsWith(github.ref, 'refs/tags/')guard — release step now runs unconditionally on every push tomain/masterMAJOR.MINORtag (filtered viagrep -E '^[0-9]+\.[0-9]+$') and increments the minor component (e.g.1.1→1.2); defaults to1.0if no prior tag existssecrets.TOKEN→secrets.GITHUB_TOKEN(always available, no repo secret needed)fetch-depth: 0so all existing tags are visible during version computationtags: v*trigger — was never matched by existing1.x-format tags and is now unnecessary