Add release.yml: auto-tag and GitHub Release on push to master#486
Add release.yml: auto-tag and GitHub Release on push to master#486
Conversation
Agent-Logs-Url: https://github.com/Xercius/Trading-Card-Game-Tracker/sessions/a28472b1-74ff-4616-9d48-ad8c114498fe Co-authored-by: Xercius <75197226+Xercius@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds a dedicated GitHub Actions workflow to automatically bump semver tags and publish GitHub Releases when changes are pushed to main, keeping release permissions scoped to this workflow.
Changes:
- Introduces
.github/workflows/release.ymltriggered on pushes tomain - Auto-tags using
mathieudutour/github-tag-action@v6.2and publishes a GitHub Release viasoftprops/action-gh-release@v2
| on: | ||
| push: | ||
| branches: [main] | ||
|
|
There was a problem hiding this comment.
Releasing on every push to main without waiting for CI means this workflow can create/push a new tag and GitHub Release even when the CI workflow fails for the same commit. Consider triggering on workflow_run for the CI workflow (and gating on conclusion: success) or otherwise adding a CI-success gate before tagging/releasing.
There was a problem hiding this comment.
@copilot dont correct this, I like the way it's implemented. But do fix the reference to main, its master
There was a problem hiding this comment.
Fixed in 6e3f300 — both the on.push.branches trigger and release_branches are now master.
| jobs: | ||
| release: | ||
| name: Auto Version & Release | ||
| runs-on: ubuntu-latest | ||
| steps: |
There was a problem hiding this comment.
This workflow can run concurrently on rapid successive pushes to main, which can race on "latest tag" calculation and cause one run to fail when pushing a tag/release that another run just created. Add a workflow-level concurrency group (e.g., one group for release on main) to serialize releases.
| - name: Create GitHub Release | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| tag_name: ${{ steps.tag.outputs.new_tag }} | ||
| name: Release ${{ steps.tag.outputs.new_tag }} | ||
| body: ${{ steps.tag.outputs.changelog }} | ||
| generate_release_notes: true |
There was a problem hiding this comment.
softprops/action-gh-release is configured with both body and generate_release_notes: true. Depending on the action/GitHub API behavior, the provided body may override auto-generated notes (or produce confusing/double content). If the intent is GitHub auto-generated notes (per PR description), drop body; if the intent is the tag-action changelog, set generate_release_notes to false.
There was a problem hiding this comment.
Done in 42d43ce — body removed; release notes are now sourced solely from generate_release_notes: true.
Agent-Logs-Url: https://github.com/Xercius/Trading-Card-Game-Tracker/sessions/b32b3aff-3278-4617-b26c-f81664a3f1a2 Co-authored-by: Xercius <75197226+Xercius@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Xercius/Trading-Card-Game-Tracker/sessions/b95deebd-8898-4e49-a143-c633ed82b42e Co-authored-by: Xercius <75197226+Xercius@users.noreply.github.com>
maintomasterbodyfrom the GitHub Release step; release notes are now generated entirely bygenerate_release_notes: trueOriginal prompt
The core idea is:
No changes to your C# or TypeScript code are required — versioning lives entirely in Git tags.
This would be a new file alongside your existing ci.yml, so it won’t interfere with your current CI:
🔢 Version Bumping Logic
The github-tag-action inspects your commit messages to decide the bump type:
Commit message containsBump typeExample result#major or BREAKING CHANGEMajorv1.0.0 → v2.0.0#minor or featMinorv1.0.0 → v1.1.0Anything elsePatch (default)v1.0.0 → v1.0.1So for most Dependabot PRs and bug fixes, you’ll just get a patch bump automatically.
📋 Auto-Generated Release Notes
GitHub’s generate_release_notes: true will automatically group your merged PRs and commits into the release body — no manual changelog writing needed.
🔐 Permissions
Your current ci.yml has permissions: contents: read globally. The new release.yml needs contents: write to push tags and create releases — keeping them as separate files is the right approach here.
⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.