diff --git a/.github/workflows/draft-release.yml b/.github/workflows/draft-release.yml new file mode 100644 index 0000000..7fbc2ca --- /dev/null +++ b/.github/workflows/draft-release.yml @@ -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 }}