Generate Tag and Release #14
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: "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 |