Draft a release #2
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 a release | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'The version number (e.g. 1.2.3) OR one of: patch|minor|major|prepatch|preminor|premajor|prerelease' | |
required: true | |
default: 'patch' | |
jobs: | |
draft-release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/python-poetry-env | |
- name: Update version | |
id: updated_version | |
shell: bash | |
run: | | |
poetry version ${{ github.event.inputs.version }} | |
version=$(poetry version --short) | |
echo ::set-output name="version::$version" | |
- name: Update changelog | |
id: changelog | |
shell: bash | |
run: | | |
poetry run kacl-cli release ${{ steps.updated_version.outputs.version }} --modify --auto-link | |
echo "" >> CHANGELOG.md | |
body=$(poetry run kacl-cli get ${{ steps.updated_version.outputs.version }}) | |
body="${body//'%'/'%25'}" | |
body="${body//$'\n'/'%0A'}" | |
body="${body//$'\r'/'%0D'}" | |
echo ::set-output name="body::$body" | |
- name: Commit changes | |
uses: EndBug/add-and-commit@v7 | |
with: | |
add: 'CHANGELOG.md pyproject.toml' | |
message: 'Release ${{ steps.updated_version.outputs.version }}' | |
- name: Create tag | |
run: | | |
git tag ${{ steps.updated_version.outputs.version }} | |
git push origin ${{ steps.updated_version.outputs.version }} | |
- name: Create a draft release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.updated_version.outputs.version }} | |
release_name: Release ${{ steps.updated_version.outputs.version }} | |
body: ${{ steps.changelog.outputs.body }} | |
draft: true |