Repository navigation
Initial commit: uv-based packaging, CI/CD, and unit tests #1
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: Release | |
| on: | |
| push: | |
| branches: [main] | |
| jobs: | |
| release: | |
| name: Bump version, tag and release | |
| if: "!contains(github.event.head_commit.message, 'chore(release):')" | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.bump.outputs.version }} | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Configure git | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Bump patch version | |
| id: bump | |
| run: | | |
| set -euo pipefail | |
| init_file="src/auth0_jwt_validator/__init__.py" | |
| pyproject_file="pyproject.toml" | |
| current=$(grep -oP '(?<=__version__ = ")[^"]+' "$init_file") | |
| IFS='.' read -r major minor patch <<< "$current" | |
| new="$major.$minor.$((patch + 1))" | |
| sed -i "s/__version__ = \"$current\"/__version__ = \"$new\"/" "$init_file" | |
| sed -i "s/^version = \"$current\"/version = \"$new\"/" "$pyproject_file" | |
| echo "version=$new" >> "$GITHUB_OUTPUT" | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@v7 | |
| - name: Update lockfile | |
| run: uv lock | |
| - name: Commit version bump | |
| run: | | |
| git add src/auth0_jwt_validator/__init__.py pyproject.toml uv.lock | |
| git commit -m "chore(release): v${{ steps.bump.outputs.version }} [skip ci]" | |
| git push origin HEAD:main | |
| - name: Tag release | |
| run: | | |
| git tag "v${{ steps.bump.outputs.version }}" | |
| git push origin "v${{ steps.bump.outputs.version }}" | |
| - name: Create GitHub release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: "v${{ steps.bump.outputs.version }}" | |
| generate_release_notes: true | |
| build: | |
| name: Build distribution | |
| needs: release | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: "v${{ needs.release.outputs.version }}" | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@v7 | |
| - name: Build package | |
| run: uv build | |
| - name: Upload distribution artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| publish: | |
| name: Publish to PyPI | |
| needs: build | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/project/auth0-jwt-validator/ | |
| permissions: | |
| id-token: write | |
| steps: | |
| - name: Download distribution artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| - name: Publish package to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 |