Skip to content

Add manual date-based release workflow#112

Merged
CLHatch merged 1 commit intomainfrom
add-release-workflow
Jan 23, 2026
Merged

Add manual date-based release workflow#112
CLHatch merged 1 commit intomainfrom
add-release-workflow

Conversation

@CLHatch
Copy link
Contributor

@CLHatch CLHatch commented Jan 23, 2026

Pull request

Purpose
Describe the problem or feature in addition to a link to the issues.

Approach
How does this change address the problem?

Open Questions and Pre-Merge TODOs
Check all boxes as they are completed

  • Use github checklists. When solved, check the box and explain the answer.

Learning
Describe the research stage
Links to blog posts, patterns, libraries or addons used to solve this problem

Requirements
Check all boxes as they are completed

Summary by Sourcery

Add a manually triggered, date-based GitHub Actions workflow to create tagged releases when meaningful changes are detected.

New Features:

  • Introduce a workflow_dispatch-triggered release workflow that can be run on demand with an optional force flag to override change detection.

CI:

  • Add a GitHub Actions release workflow that generates date-based semantic-like version tags and creates GitHub releases only when non-trivial changes are present since the last tag.

@CLHatch CLHatch requested review from a team as code owners January 23, 2026 03:23
@sourcery-ai
Copy link

sourcery-ai bot commented Jan 23, 2026

Reviewer's Guide

Adds a new manually-triggered GitHub Actions workflow to create date-based versioned releases, including logic to skip releases without meaningful changes and to generate deterministic tags by date, branch, and a daily counter.

Sequence diagram for the manual date-based release workflow

sequenceDiagram
  actor Developer
  participant GitHubUI
  participant GitHubActions
  participant ReleaseJob
  participant GitRepo
  participant GitHubReleases

  Developer->>GitHubUI: Trigger workflow_dispatch
  GitHubUI->>GitHubActions: Start Release workflow

  GitHubActions->>ReleaseJob: Run job release
  ReleaseJob->>GitRepo: Checkout repository (fetch-depth 0)

  ReleaseJob->>GitRepo: Fetch tags
  ReleaseJob->>ReleaseJob: Evaluate force_release input
  alt force_release true
    ReleaseJob->>GitHubActions: Set output skip=false
  else force_release false
    ReleaseJob->>GitRepo: Get last tag
    alt no last tag
      ReleaseJob->>GitHubActions: Set output skip=false
    else last tag exists
      ReleaseJob->>GitRepo: git diff LAST_TAG..HEAD
      alt no file changes
        ReleaseJob->>GitHubActions: Set output skip=true
      else file changes exist
        ReleaseJob->>ReleaseJob: Filter for meaningful changes
        alt meaningful changes found
          ReleaseJob->>GitHubActions: Set output skip=false
        else no meaningful changes
          ReleaseJob->>GitHubActions: Set output skip=true
        end
      end
    end
  end

  opt skip is false
    ReleaseJob->>GitRepo: Fetch tags for date prefix
    ReleaseJob->>ReleaseJob: Compute date-based prefix
    ReleaseJob->>ReleaseJob: Determine branch suffix
    ReleaseJob->>GitRepo: List tags matching prefix
    ReleaseJob->>ReleaseJob: Compute next daily counter
    ReleaseJob->>GitHubActions: Output version tag

    ReleaseJob->>GitHubReleases: gh release create version
    GitHubReleases-->>ReleaseJob: Release and tag created
  end
Loading

File-Level Changes

Change Details Files
Introduce a manual date-based GitHub Actions release workflow with change detection and automated tag generation.
  • Add a workflow_dispatch-triggered Release workflow with an optional force_release boolean input.
  • Implement a shell step to determine whether to skip a release by comparing changes since the last tag and filtering out non-meaningful file changes such as .github and documentation files.
  • Implement version tag generation using a fixed major (1), UTC date as the minor (YYYYMMDD), and an incrementing daily counter as the patch, with optional branch suffix for non-main branches.
  • Use the GitHub CLI and generated version tag to create a GitHub release with generated notes targeting the current ref.
.github/workflows/release.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've found 1 issue, and left some high level feedback:

  • The date-based versioning logic can suffer from race conditions if two releases are triggered for the same branch on the same day (both may compute the same NEXT_N before the tag exists remotely); consider adding a uniqueness guard (e.g., checking remote tags again just before creation or failing fast if the tag already exists).
  • The "meaningful changes" filter uses a hardcoded exclusion list and comments referencing templates/apps that don’t appear in this repo; it might be clearer and safer to invert this to an explicit allowlist of paths that should trigger a release, aligned with this repository’s structure.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The date-based versioning logic can suffer from race conditions if two releases are triggered for the same branch on the same day (both may compute the same NEXT_N before the tag exists remotely); consider adding a uniqueness guard (e.g., checking remote tags again just before creation or failing fast if the tag already exists).
- The "meaningful changes" filter uses a hardcoded exclusion list and comments referencing templates/apps that don’t appear in this repo; it might be clearer and safer to invert this to an explicit allowlist of paths that should trigger a release, aligned with this repository’s structure.

## Individual Comments

### Comment 1
<location> `.github/workflows/release.yml:97-106` </location>
<code_context>
+          echo "Suffix: '$SUFFIX'"
+          echo "Regex: '$REGEX'"
+
+          MAX_N="-1"
+
+          # Get all tags for this "Minor" version (v1.YYYYMMDD.*)
+          TAGS=$(git tag -l "${PREFIX}*")
+
+          for tag in $TAGS; do
+            if [[ "$tag" =~ $REGEX ]]; then
+              # Strip suffix: v1.YYYYMMDD.N
+              base="${tag%$SUFFIX}"
+              # Extract Patch (N): Remove v1.YYYYMMDD.
+              n="${base#$PREFIX.}"
+
+              # Ensure n is numeric
+              if [[ "$n" =~ ^[0-9]+$ ]]; then
+                if (( n > MAX_N )); then
+                  MAX_N=$n
+                fi
+              fi
+            fi
+          done
+
+          if [ "$MAX_N" == "-1" ]; then
+            NEXT_N=1
+          else
+            NEXT_N=$((MAX_N + 1))
+          fi
+
+          FINAL_VER="${PREFIX}.${NEXT_N}${SUFFIX}"
+
+          echo "Generated Version: $FINAL_VER"
</code_context>

<issue_to_address>
**issue (bug_risk):** Version calculation can race if multiple releases are triggered concurrently for the same branch/day.

Because `NEXT_N` is derived from `MAX_N + 1` after scanning existing tags, two concurrent runs (same `PREFIX`/`SUFFIX`) can both compute the same `NEXT_N` before either pushes its tag, leading to a tag collision or `gh release create` failure. If concurrent runs for the same branch are possible, consider adding coordination (e.g., verify tag doesn’t exist immediately before pushing and retry on conflict, or switch to a scheme that avoids tag scans, such as using the workflow run number).
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +97 to +106
MAX_N="-1"

# Get all tags for this "Minor" version (v1.YYYYMMDD.*)
TAGS=$(git tag -l "${PREFIX}*")

for tag in $TAGS; do
if [[ "$tag" =~ $REGEX ]]; then
# Strip suffix: v1.YYYYMMDD.N
base="${tag%$SUFFIX}"
# Extract Patch (N): Remove v1.YYYYMMDD.
Copy link

Choose a reason for hiding this comment

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

issue (bug_risk): Version calculation can race if multiple releases are triggered concurrently for the same branch/day.

Because NEXT_N is derived from MAX_N + 1 after scanning existing tags, two concurrent runs (same PREFIX/SUFFIX) can both compute the same NEXT_N before either pushes its tag, leading to a tag collision or gh release create failure. If concurrent runs for the same branch are possible, consider adding coordination (e.g., verify tag doesn’t exist immediately before pushing and retry on conflict, or switch to a scheme that avoids tag scans, such as using the workflow run number).

@CLHatch CLHatch merged commit fad91c2 into main Jan 23, 2026
8 checks passed
@CLHatch CLHatch deleted the add-release-workflow branch January 23, 2026 03:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant