0.1.4 #9
Workflow file for this run
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: Publish | |
on: | |
release: | |
types: [published] | |
jobs: | |
publish: | |
permissions: | |
id-token: write | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get current version from pyproject.toml | |
id: get_version | |
run: | | |
echo "VERSION=$(grep -m 1 'version =' "pyproject.toml" | awk -F'"' '{print $2}')" >> $GITHUB_ENV | |
- name: Extract tag version | |
id: extract_tag | |
run: | | |
TAG_VERSION=$(echo "${{ github.event.release.tag_name }}" | sed -E 's/v(.*)/\1/') | |
echo "TAG_VERSION=$TAG_VERSION" >> $GITHUB_ENV | |
- name: Check if tag matches version from pyproject.toml | |
id: check_tag | |
run: | | |
if [ "${{ env.TAG_VERSION }}" != "${{ env.VERSION }}" ]; then | |
echo "::error::Tag version (${{ env.TAG_VERSION }}) does not match version in pyproject.toml (${{ env.VERSION }})." | |
exit 1 | |
fi | |
- name: Install the latest version of uv | |
uses: astral-sh/setup-uv@v1 | |
with: | |
version: "latest" | |
- name: Build Package | |
run: uv build | |
- name: Upload to GitHub Release | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh release upload ${{ github.event.release.tag_name }} dist/* | |
- name: Publish package to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |