Skip to content
Closed
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
89 changes: 89 additions & 0 deletions .github/workflows/draft-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Drafts new mailtrap-n8n release: bumps the version, regenerates the changelog from
# merged PRs, and opens a release PR against main.
#
name: Draft n8n Release
on:
workflow_dispatch:
inputs:
bump_type:
description: "Semver bump type"
required: true
type: choice
options:
- patch
- minor
- major
default: patch

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

permissions:
contents: write
pull-requests: write

jobs:
draft-release:
name: Draft mailtrap-n8n Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main

- uses: actions/setup-node@v4
with:
node-version-file: .tool-versions

- name: Read current version
id: read
uses: railsware/github-actions/read-version-from-package-json@add-sdk-release-actions

- name: Compute next version
id: bump
uses: railsware/github-actions/compute-next-semver@add-sdk-release-actions
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@add-sdk-release-actions
with:
tag: ${{ steps.bump.outputs.tag }}

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

- name: Update version in package.json
if: steps.notes.outputs.release_notes != ''
run: npm version "${{ steps.bump.outputs.next }}" --no-git-tag-version

- name: Prepend new section to CHANGELOG.md
if: steps.notes.outputs.release_notes != ''
uses: railsware/github-actions/prepend-changelog@add-sdk-release-actions
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@add-sdk-release-actions
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 }}
files: package.json CHANGELOG.md

- name: Create draft GitHub release
if: steps.notes.outputs.release_notes != ''
uses: railsware/github-actions/create-draft-github-release@add-sdk-release-actions
with:
tag: ${{ steps.bump.outputs.tag }}
release-notes: ${{ steps.notes.outputs.release_notes }}
Loading