Skip to content

Add release workflow - #268

Merged
IgorDobryn merged 5 commits into
mainfrom
add-release-workflow
Nov 12, 2026
Merged

IgorDobryn merged 5 commits into
mainfrom
add-release-workflow

Conversation

@IgorDobryn

@IgorDobryn IgorDobryn commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

Releases are drafted from this repo but published from a separate central workflow with a personal access token. This moves publishing here: merging the release PR pushes the packages and publishes the drafted release once a maintainer approves it, using the workflow's own token.

Changes

  • Add a Release workflow that runs when CHANGELOG.md changes on main, with a manual run and a dry run as a fallback
  • It runs only when a draft release matches the top CHANGELOG.md version, so ordinary changelog edits are skipped
  • Restore (locked), build, test and pack Mailtrap and Mailtrap.Abstractions without any publishing rights. MinVer gets the CHANGELOG.md version through MinVerVersionOverride, since the tag only exists once the release is published
  • Publishing waits for approval on the release environment, then pushes the packages to the org's GitHub Packages feed with the workflow token (packages: write), attaches the .nupkg and .snupkg files to the GitHub Release, and pins the draft to the merged commit before publishing it
  • A version that is already released has no draft left, so the draft check stops a second publish

Before merging

  • Mailtrap and Mailtrap.Abstractions grant this repo the Write role under package settings, "Manage Actions access"

How to test

  • Run the Release workflow manually with dry_run checked: detect and build pass, the packages artifact holds both .nupkg and .snupkg pairs, Publish is skipped
  • Merge the next release PR and approve the release deployment: both packages are on the feed at the new version, and the release has the packages attached and its tag on the merge commit

@IgorDobryn
IgorDobryn requested a review from mklocek as a code owner November 11, 2026 12:09
@coderabbitai

coderabbitai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e7cb8d95-0cf7-4dc2-85e1-e55e7fc9088d
Pre-merge checks: Inconclusive 2

Failed Failed checks: 2 inconclusive

Check name Status Explanation Resolution
Title check Pending This assessment has not completed. The check will be retried on the next pre-merge check run.
Description check Pending This assessment has not completed. The check will be retried on the next pre-merge check run.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Comment thread .github/workflows/release.yml Resolved
detect runs with a read-only token, which can't see draft releases, so
resolve-pending-release now reports the newest CHANGELOG.md version as
pending until it has a published release. A real dispatch on a version
that is already released fails; the publish job's draft check confirms
the draft after approval.
The assets go onto the draft release, which users can't see yet, before
the registry publish, so the un-draft is the only step left after it.
--clobber lets a re-run of a failed job overwrite assets that were
already attached instead of failing with "asset already exists".
github.ref_name is the short name, so a manual run started from a tag
named like the default branch passed the check and would build that
tag's commit. Comparing github.ref with refs/heads/<default branch>
accepts only the branch.
A dry run continues whether or not the top CHANGELOG.md version is
released, so it passed even when detection was wrong. Decide now logs
pending and dry_run, and a dry run on an already released version gets a
warning that it didn't exercise detection.
@IgorDobryn
IgorDobryn merged commit 1dd164b into main Nov 12, 2026
3 checks passed
@IgorDobryn
IgorDobryn deleted the add-release-workflow branch November 12, 2026 13:17
@github-actions github-actions Bot mentioned this pull request Nov 12, 2026

# The draft disappears once a release is published, so this also stops a second publish.
- name: Check GitHub release
uses: railsware/github-actions/check-sdk-github-release@master

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[could] This job's token can push packages and publish releases, yet Check GitHub release here and Publish GitHub release below run whatever sits on master of railsware/github-actions at run time, so a later change to that branch ships through this job without any review in this repo. The actions/* steps in this file are already pinned to commit SHAs – pinning these two the same way (SHA plus a version comment) would close that gap.

env:
NUGET_TOKEN: ${{ github.token }}
run: |
dotnet nuget push "dist/*.nupkg" \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[could] If the Mailtrap.Abstractions push fails – for example because that package hasn't been given Actions access yet – Mailtrap can already be on the feed at the new version, and nobody can install it since the Mailtrap.Abstractions version it depends on isn't there (a plain dotnet add package Mailtrap picks it up). The glob order comes from the runner's directory listing rather than the dependency order, and dotnet nuget push stops at the first failure. Pushing dist/Mailtrap.Abstractions.*.nupkg in its own command before Mailtrap avoids leaving the feed half-published.

@@ -0,0 +1,154 @@
# Publishes the release drafted by draft-release.yml. Runs when the release PR lands on main
# (or manually, as a fallback / dry run): detects the pending draft from CHANGELOG.md, tests and

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[nitpick] This doesn't detect the pending draft: detect can't see drafts, so it treats the top CHANGELOG.md version as pending until it has a published release, and the draft is only checked after approval. The PR description ("runs only when a draft release matches the top CHANGELOG.md version") has drifted the same way – a CHANGELOG edit made while the top version is still unreleased, say after a rejected approval, builds again and asks for another approval. Worth rewording both.

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.

4 participants