Skip to content

Draft Release on Merge #3

Draft Release on Merge

Draft Release on Merge #3

Workflow file for this run

name: Draft Release on Merge
on:
workflow_run:
workflows: ["Pytest-Black-Ruff"]
types:
- completed
branches:
- main
push:
branches:
- main
jobs:
draft-release:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
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