Skip to content

build(deps): update __meta__.py and pyproject.toml #77

build(deps): update __meta__.py and pyproject.toml

build(deps): update __meta__.py and pyproject.toml #77

Workflow file for this run

name: Release
on:
push:
branches: [master]
jobs:
release:
name: Build & publish
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Extract version
id: meta
run: |
VERSION=$(grep '^version' pyproject.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "tag=v$VERSION" >> $GITHUB_OUTPUT
- name: Check if tag already exists
id: tag_check
run: |
if git ls-remote --tags origin "refs/tags/v${{ steps.meta.outputs.version }}" | grep -q .; then
echo "exists=true" >> $GITHUB_OUTPUT
echo "Tag v${{ steps.meta.outputs.version }} already exists — skipping release."
else
echo "exists=false" >> $GITHUB_OUTPUT
echo "Tag v${{ steps.meta.outputs.version }} not found — starting release."
fi
- name: Set up Python
if: steps.tag_check.outputs.exists == 'false'
uses: actions/setup-python@v6
with:
python-version: "3.13"
- name: Install build tools
if: steps.tag_check.outputs.exists == 'false'
run: pip install build twine
- name: Build package
if: steps.tag_check.outputs.exists == 'false'
run: python -m build
- name: Publish to PyPI
if: steps.tag_check.outputs.exists == 'false'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: twine upload dist/*
- name: Create tag
if: steps.tag_check.outputs.exists == 'false'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag "v${{ steps.meta.outputs.version }}"
git push origin "v${{ steps.meta.outputs.version }}"
- name: Create GitHub release
if: steps.tag_check.outputs.exists == 'false'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "v${{ steps.meta.outputs.version }}" dist/* \
--title "v${{ steps.meta.outputs.version }}" \
--generate-notes