fix: auto-create GitHub release on every push to main by Copilot · Pull Request #3 · Programmercito/switcher-version-tools · GitHub
Skip to content

fix: auto-create GitHub release on every push to main#3

Merged
Programmercito merged 3 commits into
mainfrom
copilot/fix-release-deployment-issue
Apr 4, 2026
Merged

fix: auto-create GitHub release on every push to main#3
Programmercito merged 3 commits into
mainfrom
copilot/fix-release-deployment-issue

Conversation

Copilot AI commented Apr 4, 2026

Copy link
Copy Markdown
Contributor

The release workflow built binaries on every push to main but gated the actual release creation behind if: startsWith(github.ref, 'refs/tags/'), so no release was ever published unless a tag was pushed manually. Additionally, secrets.TOKEN is not a built-in secret and may be unset.

Changes

  • Remove if: startsWith(github.ref, 'refs/tags/') guard — release step now runs unconditionally on every push to main/master
  • Auto-generate version tag — new "Get next version" step reads the latest MAJOR.MINOR tag (filtered via grep -E '^[0-9]+\.[0-9]+$') and increments the minor component (e.g. 1.11.2); defaults to 1.0 if no prior tag exists
  • Auto-push tag — new step creates and pushes the computed tag before the release step runs
  • Fix token referencesecrets.TOKENsecrets.GITHUB_TOKEN (always available, no repo secret needed)
  • Full history checkout — added fetch-depth: 0 so all existing tags are visible during version computation
  • Remove tags: v* trigger — was never matched by existing 1.x-format tags and is now unnecessary

Copilot AI linked an issue Apr 4, 2026 that may be closed by this pull request
Copilot AI and others added 2 commits April 4, 2026 00:39
Copilot AI changed the title [WIP] Fix release deployment issue after commit to main fix: auto-create GitHub release on every push to main Apr 4, 2026
Copilot AI requested a review from Programmercito April 4, 2026 00:40

@Programmercito Programmercito left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

El token se llama TOKEN y no github_token

@Programmercito Programmercito marked this pull request as ready for review April 4, 2026 01:00
@Programmercito Programmercito requested a review from Copilot April 4, 2026 01:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.MINOR tag 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.

Copilot AI Apr 4, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
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)

Copilot uses AI. Check for mistakes.
Comment on lines +54 to +55

Copilot AI Apr 4, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.
@Programmercito Programmercito merged commit fc0ef9e into main Apr 4, 2026
4 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.

No se despliega el nuevo release

3 participants