Skip to content

New: Auto Draft Release workflow. (#2) #1

New: Auto Draft Release workflow. (#2)

New: Auto Draft Release workflow. (#2) #1

Workflow file for this run

name: Draft Release on Merge
on:
push:
branches:
- main
jobs:
draft-release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install toml
run: pip install toml
- name: Get version from pyproject.toml
id: get_version
run: |
VERSION=$(python -c "import toml; print(toml.load('pyproject.toml')['tool']['poetry']['version'])")
echo "::set-output name=version::$VERSION"
- name: Generate release notes
id: generate_release_notes
run: |
echo "Release notes for version ${{ steps.get_version.outputs.version }}" > release_notes.md
git log $(git describe --tags --abbrev=0 2>/dev/null || echo HEAD)..HEAD --pretty=format:"- %s" >> release_notes.md
- name: Create Release Draft
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.get_version.outputs.version }}
release_name: Release v${{ steps.get_version.outputs.version }}
body_path: release_notes.md
draft: true