Draft release #72
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Draft release | |
on: | |
workflow_call: | |
inputs: | |
release-type: | |
description: 'Release type' | |
required: true | |
default: 'minor' | |
type: string | |
version-number-override: | |
description: 'Version number override' | |
required: false | |
type: string | |
workflow_dispatch: | |
inputs: | |
release-type: | |
description: 'Release type' | |
required: true | |
default: 'minor' | |
type: choice | |
options: | |
- major | |
- minor | |
- patch | |
version-number-override: | |
description: 'Version number override' | |
required: false | |
type: string | |
jobs: | |
draft: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.GITFLOW_PUSH_TOKEN }} | |
- name: Get latest version from changelog | |
if: ${{ github.event.inputs.version-number-override == '' }} | |
id: changelog | |
uses: mindsers/changelog-reader-action@v2 | |
with: | |
path: ./CHANGELOG.md | |
- name: Get version number to release (Semver) | |
if: ${{ github.event.inputs.version-number-override == '' }} | |
uses: cbrgm/semver-bump-action@v1 | |
id: bump-semver | |
with: | |
current-version: ${{ steps.changelog.outputs.version }} | |
bump-level: ${{ github.event.inputs.release-type }} | |
- name: Assign version number to release (Semver) | |
if: ${{ github.event.inputs.version-number-override == '' }} | |
run: | | |
echo "VERSION=${{ steps.bump-semver.outputs.new_version }}" >> $GITHUB_ENV | |
- name: Assign version number to release (manual) | |
if: ${{ github.event.inputs.version-number-override != '' }} | |
run: | | |
echo "VERSION=${{ github.event.inputs.version-number-override }}" >> $GITHUB_ENV | |
- name: Update changelog | |
uses: thomaseizinger/keep-a-changelog-new-release@ec0871fec381db64ab389886ffe8e6fc2b661e2c | |
with: | |
version: ${{ env.VERSION }} | |
tag: v${{ env.VERSION }} | |
- name: Commit and push changes | |
uses: EndBug/add-and-commit@v9 | |
with: | |
add: 'CHANGELOG.md' | |
default_author: github_actor | |
message: 'chore: prepare release v${{ env.VERSION }}' | |
new_branch: 'release/${{ env.VERSION }}' | |
push: true | |
- name: Create pull request for release | |
uses: thomaseizinger/create-pull-request@52baa147b387effeeb9cf04e121227dbfb74994e | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITFLOW_PUSH_TOKEN }} | |
with: | |
head: release/${{ env.VERSION }} | |
base: main | |
title: Release v${{ env.VERSION }} | |
body: | | |
Hi @${{ github.actor }}! | |
This PR was created in response to a manual trigger of the release workflow here: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}. | |
Merging this PR will publish the release. |