chore: Prefix v2 in the endpoint methods. (#5) #12
This file contains hidden or 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 Package | |
| on: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| id-token: write | |
| contents: write | |
| jobs: | |
| check-if-tag: | |
| name: Check if Tag is Present | |
| runs-on: ubuntu-22.04 | |
| outputs: | |
| TAG_NOT_PRESENT: ${{ steps.get-tag.outputs.TAG_NOT_PRESENT }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get the tag from Python and check if it's present | |
| id: get-tag | |
| run: | | |
| pip install toml | |
| VERSION=$(python -c "import toml; print(toml.load('pyproject.toml')['project']['version'])") | |
| if git tag -l "v$VERSION" | grep -q .; then | |
| echo "Tag v$VERSION is present" | |
| echo "TAG_NOT_PRESENT=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "Tag v$VERSION is not present" | |
| echo "TAG_NOT_PRESENT=true" >> $GITHUB_OUTPUT | |
| git tag "v$VERSION" | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git push origin "v$VERSION" | |
| fi | |
| publish: | |
| name: Publish Package to PyPI | |
| runs-on: ubuntu-22.04 | |
| needs: check-if-tag | |
| if: needs.check-if-tag.outputs.TAG_NOT_PRESENT == 'true' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.14" | |
| - run: pip install build twine | |
| - run: pip install -e ".[dev]" | |
| - run: python -m build | |
| - name: Publish release distributions to PyPI | |
| uses: pypa/gh-action-pypi-publish@v1.13.0 |