feat: Add Pyright type checking #21
Workflow file for this run
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: | |
pull_request: | |
types: [closed] | |
branches: [main] | |
permissions: | |
contents: write | |
id-token: write | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/') | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install uv | |
run: | | |
curl -LsSf https://astral.sh/uv/install.sh | sh | |
echo "$HOME/.cargo/bin" >> $GITHUB_PATH | |
- name: Install dependencies | |
run: | | |
uv venv | |
uv pip install -e . | |
uv pip install hatch | |
- name: Build package | |
run: uv run hatch build | |
- name: Get version from pyproject.toml | |
id: get_version | |
run: | | |
VERSION=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])") | |
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |
- name: Create git tag | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git tag v${{ steps.get_version.outputs.VERSION }} | |
git push origin v${{ steps.get_version.outputs.VERSION }} | |
- name: Publish draft release | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
# Check if draft release exists and publish it | |
if gh release view v${{ steps.get_version.outputs.VERSION }} --json isDraft | jq -r '.isDraft' | grep -q true; then | |
gh release edit v${{ steps.get_version.outputs.VERSION }} --draft=false | |
else | |
echo "::error::No draft release found for v${{ steps.get_version.outputs.VERSION }}" | |
exit 1 | |
fi | |
- name: Upload assets to release | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
gh release upload v${{ steps.get_version.outputs.VERSION }} dist/* | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.PYPI_ART_TOKEN }} |