style: apply Python 3.13 linter fixes #156
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 & Release Package | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v4 | |
- name: Set up Python | |
run: uv python install | |
- name: Install release dependencies | |
run: make setup | |
- name: Detect version upgrade | |
id: versioning | |
run: | | |
package_version=$(uvx hatch version) | |
echo "package_version=$package_version" >> $GITHUB_OUTPUT | |
upgraded=$(git tag --list | grep -q "${package_version}$" && echo "false" || echo "true") | |
echo "upgraded=$upgraded" >> $GITHUB_OUTPUT | |
pre_release=$([[ $package_version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && echo "false" || echo "true") | |
echo "pre_release=$pre_release" >> $GITHUB_OUTPUT | |
pypi_env=$([[ $pre_release == "true" ]] && echo "dev" || echo "prd") | |
echo "pypi_env=$pypi_env" >> $GITHUB_OUTPUT | |
main_branch_release=$([[ $pre_release == "false" && $GITHUB_REF_NAME == "main" ]] && echo "true" || echo "false") | |
alternative_branch_release=$([[ $pre_release == "true" && $GITHUB_REF_NAME != "main" ]] && echo "true" || echo "false") | |
should_release=$([[ $upgraded == "true" && ($main_branch_release == "true" || $alternative_branch_release == "true") ]] && echo "true" || echo "false") | |
echo "should_release=$should_release" >> $GITHUB_OUTPUT | |
echo "upgraded=$upgraded" | |
echo "pre_release=$pre_release" | |
echo "git_ref=$GITHUB_REF_NAME" | |
echo "main_branch_release=$main_branch_release" | |
echo "alternative_branch_release=$alternative_branch_release" | |
echo "should_release=$should_release" | |
- name: Create Release | |
if: ${{ steps.versioning.outputs.should_release == 'true' }} | |
run: gh release create ${{ steps.versioning.outputs.package_version }} --generate-notes | |
env: | |
GITHUB_TOKEN: ${{ secrets.gh_token }} | |
- name: Build & Publish package | |
if: ${{ steps.versioning.outputs.should_release == 'true' }} | |
run: | | |
uv build |