Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 23, 2025

Overview

This PR completely redesigns the GitHub Actions workflow to implement intelligent release and artifact management. The workflow now builds on every push and merge, automatically updating artifacts for existing releases or creating new releases when the version changes.

Problem

The previous workflow had several limitations:

  • Only triggered on manual tag pushes (v*)
  • Always created a new release (no artifact updates)
  • Required manual tag creation before running
  • No continuous integration for regular development work

Solution

The workflow has been redesigned with smart release management:

🔄 Continuous Integration

  • Triggers on all pushes to any branch
  • Triggers on all merged pull requests
  • Ensures every code change is built and validated

🧠 Intelligent Release Logic

The workflow now follows this decision flow:

  1. Build the project and extract version from Beblia.Sharp.csproj
  2. Check if a release exists for tag v{version} using GitHub API
  3. If release exists:
    • Delete all old assets from the release
    • Upload fresh build artifacts
    • No new release or tag created
  4. If release doesn't exist:
    • Create git tag if needed
    • Create new GitHub release
    • Upload build artifacts

📦 Artifact Management

  • NuGet package (.nupkg) and compiled DLL are always kept up-to-date
  • Existing releases get refreshed artifacts on every push (same version)
  • New releases are created automatically when version is bumped

Key Features

  • Version-based: Release decisions based on <Version> in csproj file
  • Tag safety: Checks for existing tags before creating to avoid conflicts
  • Clear logging: Informative messages at each step for transparency
  • Error handling: Robust conditionals prevent duplicate releases/tags
  • Backward compatible: No breaking changes to project structure

Example Workflows

Scenario 1: Bug Fix (Same Version)

Developer pushes hotfix → Workflow builds → Finds v1.0.0 release → Updates artifacts
Result: Existing release v1.0.0 now has fresh build

Scenario 2: New Feature (Version Bump)

Developer changes version to 1.0.1 → Workflow builds → No v1.0.1 found → Creates release
Result: New release v1.0.1 created with artifacts

Scenario 3: Feature Branch

Developer pushes to feature branch → Workflow builds → Validates compilation
Result: Continuous integration without affecting releases

Changes

  • .github/workflows/release.yml: Complete redesign (+120 lines, -36 lines)
    • Changed triggers from tag-based to push/PR-based
    • Added release existence check via GitHub API
    • Added conditional asset deletion for existing releases
    • Added conditional release creation for new versions
    • Improved logging and error handling

Testing

✅ YAML syntax validated
✅ Workflow structure verified (12 steps)
✅ CodeQL security analysis passed (0 alerts)
✅ Build and pack tested locally

Benefits

  1. Continuous Integration: Every push is validated
  2. Always Fresh: Release artifacts are always the latest build
  3. Automated: No manual tag/release creation needed
  4. Clean History: Version bumps create new releases, fixes update existing ones
  5. Developer Friendly: Works with any Git workflow or branching strategy

Migration Notes

  • No breaking changes
  • Workflow runs more frequently (on every push vs. only tags)
  • Version in csproj now controls release creation
  • Old tag-based approach no longer needed

Fixes the requirement to build on all pushes and merges while intelligently managing releases and artifacts based on version changes.

Original prompt

make the workflow build in all pushes and all merges, but if the versions are the same or if there is an existing release, just update the artifacts. if not then create a new release


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits October 23, 2025 17:41
… create release

Co-authored-by: russkyc <32549126+russkyc@users.noreply.github.com>
Co-authored-by: russkyc <32549126+russkyc@users.noreply.github.com>
Copilot AI changed the title [WIP] Adjust workflow for builds and releases based on versioning Implement smart release management: build on all pushes/merges with automatic artifact updates Oct 23, 2025
Copilot AI requested a review from russkyc October 23, 2025 17:48
@russkyc russkyc marked this pull request as ready for review October 23, 2025 17:48
@russkyc russkyc merged commit d462d76 into master Oct 23, 2025
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