Skip to content

Generate Tag and Release #14

Generate Tag and Release

Generate Tag and Release #14

name: "Generate Tag and Release"
on:
workflow_dispatch:
jobs:
release:
name: Create Tag and 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.10'
- name: Get version from __init__.py
id: get_version
run: |
VERSION=$(python -c "import re; content=open('src/gentun/__init__.py').read(); version=re.search(r'__version__ = \"(.*?)\"', content).group(1); print(version)")
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Create and Push Tag
run: |
git tag v${{ steps.get_version.outputs.version }}
git push origin v${{ steps.get_version.outputs.version }}
- name: Generate Release Notes
id: generate_notes
uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
config-name: release-drafter.yml
version: ${{ steps.get_version.outputs.version }}
- name: Create and Upload Release
id: create_release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.get_version.outputs.version }}
name: Release v${{ steps.get_version.outputs.version }}
body: ${{ steps.generate_notes.outputs.body }}
draft: true