Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 73 additions & 7 deletions .github/workflows/draft-release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Placeholder draft-release workflow
# Drafts new mailtrap-dotnet release: computes the next version from the latest GitHub release,
# regenerates the changelog from merged PRs, and opens a release PR against main.
#
name: Draft dotnet Release
# The version is managed by MinVer, which derives it from the git tag
# current version is read from the latest published GitHub release (vX.Y.Z).
#
name: Draft .NET Release
on:
workflow_dispatch:
inputs:
Expand All @@ -14,14 +18,76 @@ on:
- major
default: patch

concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false

permissions:
contents: write
pull-requests: write

jobs:
draft-release:
name: Draft dotnet Release (placeholder)
name: Draft mailtrap-dotnet Release
runs-on: ubuntu-latest
steps:
- name: Echo inputs
- uses: actions/checkout@v4
with:
ref: main

- name: Read current version from latest release
id: read
env:
BUMP_TYPE: ${{ inputs.bump_type }}
GH_TOKEN: ${{ github.token }}
run: |
echo "Placeholder draft-release workflow"
echo "bump_type=$BUMP_TYPE"
latest=$(gh api "repos/$GITHUB_REPOSITORY/releases/latest" --jq '.tag_name')
echo "version=${latest#v}" >> "$GITHUB_OUTPUT"

- name: Compute next version
id: bump
uses: railsware/github-actions/compute-next-semver@master
with:
current: ${{ steps.read.outputs.version }}
bump-type: ${{ inputs.bump_type }}

- name: Abort if tag already exists
uses: railsware/github-actions/abort-if-tag-exists@master
with:
tag: ${{ steps.bump.outputs.tag }}

- name: Generate release notes
id: notes
uses: railsware/github-actions/generate-release-notes@master
with:
tag: ${{ steps.bump.outputs.tag }}

- name: Update version in README.md install commands
if: steps.notes.outputs.release_notes != ''
env:
NEXT: ${{ steps.bump.outputs.next }}
run: |
sed -i -E "s/(dotnet add package [^ ]+ -v )[0-9]+\.[0-9]+\.[0-9]+/\1${NEXT}/g" README.md

- name: Prepend new section to CHANGELOG.md
if: steps.notes.outputs.release_notes != ''
uses: railsware/github-actions/prepend-changelog@master
with:
version: ${{ steps.bump.outputs.next }}
release-notes: ${{ steps.notes.outputs.release_notes }}

- name: Commit, push, open PR
if: steps.notes.outputs.release_notes != ''
uses: railsware/github-actions/open-sdk-release-pr@master
with:
tag: ${{ steps.bump.outputs.tag }}
current: ${{ steps.read.outputs.version }}
next: ${{ steps.bump.outputs.next }}
bump-type: ${{ inputs.bump_type }}
release-notes: ${{ steps.notes.outputs.release_notes }}

- name: Create draft GitHub release
if: steps.notes.outputs.release_notes != ''
uses: railsware/github-actions/create-draft-github-release@master
with:
tag: ${{ steps.bump.outputs.tag }}
release-notes: ${{ steps.notes.outputs.release_notes }}
4 changes: 0 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Changelog

## [Unreleased]

## [3.2.0] - 2026-05-14

- Add api token, webhook and sub account endpoints by @IgorDobryn in https://github.com/mailtrap/mailtrap-dotnet/pull/240
Expand Down
Loading