Skip to content

ci: enable automatic GitVersion tag creation on main - #88

Merged
mpaulosky merged 1 commit into
mainfrom
squad/88-gitversion-tag-push
Apr 20, 2026
Merged

ci: enable automatic GitVersion tag creation on main#88
mpaulosky merged 1 commit into
mainfrom
squad/88-gitversion-tag-push

Conversation

@mpaulosky

Copy link
Copy Markdown
Owner

Add step to CI workflow that creates and pushes git tags for each commit to main, using GitVersion-determined semver.

This completes the v1.0.1 release flow:

  • Merge PR to main
  • CI determines version with GitVersion
  • CI creates and pushes tag (v1.0.1, v1.0.2, ...)
  • Team creates GitHub Release from tag

Closes: versioning automation setup

When CI runs on main after merge, create and push the git tag based on
GitVersion-determined semver. This enables v1.0.1, v1.0.2, etc. to be
automatically tagged without manual intervention.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 20, 2026 22:12
@github-actions

Copy link
Copy Markdown
Contributor

🏗️ PR Added to Squad Triage Queue

This PR has been labeled with squad and added to the triage queue.

Next steps:

  • The squad Lead will review and assign to an appropriate team member
  • A squad:member label will be added after triage

If you know which squad member should handle this, you can add the appropriate squad:member label yourself.

@github-actions github-actions Bot added the squad Squad triage inbox — Lead will assign to a member label Apr 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Code Coverage

Package Line Rate Branch Rate Complexity Health
Domain 0% 0% 77
Web 0% 0% 337
ServiceDefaults 0% 0% 18
Domain 0% 0% 77
Web 0% 0% 337
ServiceDefaults 0% 0% 18
AppHost 0% 100% 1
Domain 20% 0% 77
Web 5% 1% 337
ServiceDefaults 0% 0% 18
AppHost 0% 100% 1
Domain 20% 0% 77
Web 5% 1% 337
ServiceDefaults 0% 0% 18
Domain 87% 92% 77
Web 64% 65% 337
ServiceDefaults 0% 0% 18
Domain 87% 92% 77
Web 64% 65% 337
ServiceDefaults 0% 0% 18
Summary 23% (1164 / 4982) 22% (382 / 1776) 2594

@github-actions

Copy link
Copy Markdown
Contributor

Summary

Summary
Generated on: 04/20/2026 - 22:14:59
Coverage date: 04/20/2026 - 22:13:36 - 04/20/2026 - 22:14:44
Parser: MultiReport (4x Cobertura)
Assemblies: 4
Classes: 51
Files: 50
Line coverage: 66.4% (556 of 837)
Covered lines: 556
Uncovered lines: 281
Coverable lines: 837
Total lines: 2525
Branch coverage: 66.5% (189 of 284)
Covered branches: 189
Total branches: 284
Method coverage: Feature is only available for sponsors
Tag: 97_24693064366

Coverage

AppHost - 0%
Name Line Branch
AppHost 0% ****
Program 0%
Domain - 87.2%
Name Line Branch
Domain 87.2% 91.6%
Domain.Abstractions.Result 95% 50%
Domain.Abstractions.Result`1 75% 50%
MyBlog.Domain.Behaviors.ValidationBehavior`2 100% 100%
MyBlog.Domain.Entities.BlogPost 100%
MyBlog.Domain.Features.BlogPosts.Commands.CreateBlogPost.CreateBlogPostComm
and
100%
MyBlog.Domain.Features.BlogPosts.Commands.CreateBlogPost.CreateBlogPostComm
andHandler
100%
MyBlog.Domain.Features.BlogPosts.Commands.CreateBlogPost.CreateBlogPostComm
andValidator
0%
MyBlog.Domain.Features.BlogPosts.Commands.DeleteBlogPost.DeleteBlogPostComm
and
100%
MyBlog.Domain.Features.BlogPosts.Commands.DeleteBlogPost.DeleteBlogPostComm
andHandler
100%
MyBlog.Domain.Features.BlogPosts.Commands.DeleteBlogPost.DeleteBlogPostComm
andValidator
0%
MyBlog.Domain.Features.BlogPosts.Commands.UpdateBlogPost.UpdateBlogPostComm
and
100%
MyBlog.Domain.Features.BlogPosts.Commands.UpdateBlogPost.UpdateBlogPostComm
andHandler
100% 100%
MyBlog.Domain.Features.BlogPosts.Commands.UpdateBlogPost.UpdateBlogPostComm
andValidator
0%
MyBlog.Domain.Features.BlogPosts.Queries.GetAllBlogPosts.GetAllBlogPostsQue
ryHandler
100%
MyBlog.Domain.Features.BlogPosts.Queries.GetBlogPostById.GetBlogPostByIdQue
ry
100%
MyBlog.Domain.Features.BlogPosts.Queries.GetBlogPostById.GetBlogPostByIdQue
ryHandler
100% 100%
ServiceDefaults - 0%
Name Line Branch
ServiceDefaults 0% 0%
Microsoft.Extensions.Hosting.Extensions 0% 0%
Web - 68.7%
Name Line Branch
Web 68.7% 69%
MyBlog.Web.Components.Layout.MainLayout 100%
MyBlog.Web.Components.Layout.NavMenu 82.8% 71.4%
MyBlog.Web.Components.Pages.Error 100% 75%
MyBlog.Web.Components.Routes 0% 0%
MyBlog.Web.Components.Shared.RedirectToLogin 100%
MyBlog.Web.Data.BlogDbContext 100%
MyBlog.Web.Data.BlogPostDto 100%
MyBlog.Web.Data.BlogPostMappings 100%
MyBlog.Web.Data.MongoDbBlogPostRepository 100% 100%
MyBlog.Web.Features.BlogPosts.Create.Create 75% 50%
MyBlog.Web.Features.BlogPosts.Create.CreateBlogPostCommand 100%
MyBlog.Web.Features.BlogPosts.Create.CreateBlogPostCommandValidator 100%
MyBlog.Web.Features.BlogPosts.Create.CreateBlogPostHandler 100%
MyBlog.Web.Features.BlogPosts.Delete.ConfirmDeleteDialog 100% 100%
MyBlog.Web.Features.BlogPosts.Delete.DeleteBlogPostCommand 100%
MyBlog.Web.Features.BlogPosts.Delete.DeleteBlogPostCommandValidator 100%
MyBlog.Web.Features.BlogPosts.Delete.DeleteBlogPostHandler 100%
MyBlog.Web.Features.BlogPosts.Edit.Edit 88% 75%
MyBlog.Web.Features.BlogPosts.Edit.EditBlogPostCommand 100%
MyBlog.Web.Features.BlogPosts.Edit.EditBlogPostCommandValidator 100%
MyBlog.Web.Features.BlogPosts.Edit.EditBlogPostHandler 84% 90%
MyBlog.Web.Features.BlogPosts.Edit.GetBlogPostByIdQuery 100%
MyBlog.Web.Features.BlogPosts.List.GetBlogPostsHandler 100% 100%
MyBlog.Web.Features.BlogPosts.List.Index 86.8% 84.6%
MyBlog.Web.Features.UserManagement.AssignRoleCommand 100%
MyBlog.Web.Features.UserManagement.ManageRoles 90.4% 75%
MyBlog.Web.Features.UserManagement.Profile 97.2% 82%
MyBlog.Web.Features.UserManagement.RemoveRoleCommand 100%
MyBlog.Web.Features.UserManagement.RoleDto 100%
MyBlog.Web.Features.UserManagement.UserManagementHandler 0% 0%
MyBlog.Web.Features.UserManagement.UserWithRolesDto 100%
MyBlog.Web.Security.RoleClaimsHelper 91.8% 91.1%
Program 0% 0%

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

Adds automatic git tag creation to the existing CI workflow so pushes to main can produce a v{semver} tag derived from GitVersion, enabling a release flow based on tags.

Changes:

  • Add a CI step that tags the current commit on main with v${{ steps.gitversion.outputs.semVer }}.
  • Push the created tag back to origin from CI.

Comment thread .github/workflows/ci.yml
Comment on lines +150 to +152
echo "Creating tag: $TAG"
git tag "$TAG" || echo "Tag already exists: $TAG"
git push origin "$TAG" || echo "Tag already pushed"

Copilot AI Apr 20, 2026

Copy link

Choose a reason for hiding this comment

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

The || echo ... fallbacks on git tag/git push will mask real failures (e.g., permission issues, remote rejection because the tag already exists, or trying to push a tag that wasn't created locally). This can make the workflow appear successful even when no tag was pushed. Prefer explicit existence checks (local+remote) and only treat "already exists" as success; otherwise fail the step so release automation doesn't silently break.

Suggested change
echo "Creating tag: $TAG"
git tag "$TAG" || echo "Tag already exists: $TAG"
git push origin "$TAG" || echo "Tag already pushed"
echo "Ensuring tag exists locally and remotely: $TAG"
if git rev-parse -q --verify "refs/tags/$TAG" >/dev/null; then
echo "Tag already exists locally: $TAG"
else
echo "Creating local tag: $TAG"
git tag "$TAG"
fi
if git ls-remote --tags origin "refs/tags/$TAG" | grep -q "refs/tags/$TAG$"; then
echo "Tag already exists on remote: $TAG"
else
echo "Pushing tag to remote: $TAG"
git push origin "$TAG"
fi

Copilot uses AI. Check for mistakes.
Comment thread .github/workflows/ci.yml
Comment on lines +144 to +152
- name: Create and Push Git Tag
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="v${{ steps.gitversion.outputs.semVer }}"
echo "Creating tag: $TAG"
git tag "$TAG" || echo "Tag already exists: $TAG"
git push origin "$TAG" || echo "Tag already pushed"

Copilot AI Apr 20, 2026

Copy link

Choose a reason for hiding this comment

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

This step attempts to git push origin "$TAG", but the job's workflow token permissions are currently contents: read (see job-level permissions earlier in this file). With read-only contents permissions, pushing tags will be rejected. Update the workflow/job permissions to contents: write (or move tagging into a separate job with elevated permissions) so the tag push can succeed.

Copilot uses AI. Check for mistakes.
Comment thread .github/workflows/ci.yml
Comment on lines +145 to +149
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="v${{ steps.gitversion.outputs.semVer }}"

Copilot AI Apr 20, 2026

Copy link

Choose a reason for hiding this comment

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

TAG="v${{ steps.gitversion.outputs.semVer }}" relies on the gitversion step outputs, but the GitVersion setup/execute steps are configured with continue-on-error: true. If GitVersion fails, semVer can be empty and this step would create/push an invalid tag like v. Add a guard (e.g., require steps.gitversion.outcome == 'success' and a non-empty semVer) or fail the job when GitVersion can't determine a version on main.

Suggested change
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="v${{ steps.gitversion.outputs.semVer }}"
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.gitversion.outcome == 'success' && steps.gitversion.outputs.semVer != ''
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
SEMVER="${{ steps.gitversion.outputs.semVer }}"
if [ -z "$SEMVER" ]; then
echo "GitVersion did not produce a semVer output; refusing to create a tag."
exit 1
fi
TAG="v$SEMVER"

Copilot uses AI. Check for mistakes.
@mpaulosky
mpaulosky merged commit 341b46a into main Apr 20, 2026
13 checks passed
@mpaulosky
mpaulosky deleted the squad/88-gitversion-tag-push branch April 20, 2026 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

squad Squad triage inbox — Lead will assign to a member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants