fix circular import issue (#37) #41
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 PyPI | |
| on: | |
| push: | |
| branches: | |
| - main # publish on push to main | |
| permissions: | |
| contents: write # required for creating tags | |
| id-token: write # required for Trusted Publishing (OIDC) | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/vercel | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: astral-sh/setup-uv@v3 | |
| - run: uv venv --python 3.12 | |
| - run: uv pip install build | |
| - name: Create tag from version | |
| run: | | |
| VERSION=$(python - <<'PY' | |
| import tomllib | |
| import sys | |
| print(tomllib.load(open("pyproject.toml","rb"))["project"]["version"]) | |
| PY | |
| ) | |
| TAG="v$VERSION" | |
| # Check if tag already exists | |
| if git rev-parse "$TAG" >/dev/null 2>&1; then | |
| echo "Tag $TAG already exists, skipping tag creation" | |
| else | |
| echo "Creating tag $TAG" | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| git tag "$TAG" | |
| git push origin "$TAG" | |
| fi | |
| - name: Verify tag matches version | |
| run: | | |
| VERSION=$(python - <<'PY' | |
| import tomllib | |
| import sys | |
| print(tomllib.load(open("pyproject.toml","rb"))["project"]["version"]) | |
| PY | |
| ) | |
| TAG="v$VERSION" | |
| echo "Verifying tag $TAG matches version $VERSION" | |
| - name: Build | |
| run: uv run python -m build | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 |