package #5
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: Tag New Version | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
jobs: | |
tag_version: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Extract version from pyproject.toml | |
id: extract_version | |
run: | | |
VERSION=$(grep -E '^version\s*=' pyproject.toml | sed -E 's/version = "(.*)"/\1/') | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Create and push tag | |
env: | |
VERSION: ${{ env.VERSION }} | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git tag -a "v$VERSION" -m "Version $VERSION" | |
git push -f origin "v$VERSION" |