fix: trigger release on push to main/master, not only on tag push by Copilot · Pull Request #1 · Programmercito/switcher-version-tools · GitHub
Skip to content

fix: trigger release on push to main/master, not only on tag push#1

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-release-deployment-on-main
Draft

fix: trigger release on push to main/master, not only on tag push#1
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-release-deployment-on-main

Conversation

Copilot AI commented Apr 4, 2026

Copy link
Copy Markdown
Contributor

The Release step was gated with if: startsWith(github.ref, 'refs/tags/'), so pushes to main/master built the binaries but never published a release. Also, the workflow relied on secrets.TOKEN (a manually configured PAT) instead of the built-in GITHUB_TOKEN.

Changes

  • Removed if: startsWith(github.ref, 'refs/tags/') guard from the Release step
  • Added a Set release tag step to derive the correct tag at runtime:
    • Branch push → tag=latest, prerelease=true
    • Tag push → tag=<tag_name>, prerelease=false
  • Passed tag_name and prerelease inputs to softprops/action-gh-release@v2; used fromJSON() to coerce the shell string output to a proper boolean
  • Replaced env: GITHUB_TOKEN: ${{ secrets.TOKEN }} with token: ${{ secrets.GITHUB_TOKEN }} (built-in, no manual secret needed)
- name: Set release tag
  id: release_tag
  run: |
    if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
      echo "tag=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
      echo "prerelease=false" >> $GITHUB_OUTPUT
    else
      echo "tag=latest" >> $GITHUB_OUTPUT
      echo "prerelease=true" >> $GITHUB_OUTPUT
    fi

- name: Release
  uses: softprops/action-gh-release@v2
  with:
    tag_name: ${{ steps.release_tag.outputs.tag }}
    prerelease: ${{ fromJSON(steps.release_tag.outputs.prerelease) }}
    token: ${{ secrets.GITHUB_TOKEN }}

Copilot AI changed the title [WIP] Fix release deployment when committing to main or master fix: trigger release on push to main/master, not only on tag push Apr 4, 2026
Copilot AI requested a review from Programmercito April 4, 2026 00:33
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.

2 participants