Merge pull request #38 from 15r10nk/readme-update #191
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: CI | |
on: | |
pull_request: | |
push: | |
branches: [main] | |
jobs: | |
mypy: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ['3.8', '3.10', '3.11', '3.12', '3.13'] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{matrix.python-version}} | |
architecture: x64 | |
allow-prereleases: true | |
- run: pip install hatch | |
- run: hatch run +py=${{matrix.python-version}} types:check | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14'] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{matrix.python-version}} | |
architecture: x64 | |
allow-prereleases: true | |
- run: pip install hatch | |
- run: hatch test -py ${{matrix.python-version}} | |
publish: | |
name: Publish new release | |
runs-on: ubuntu-latest | |
needs: [test, mypy] | |
environment: pypi | |
permissions: | |
# IMPORTANT: this permission is mandatory for Trusted Publishing | |
id-token: write | |
# this permission is mandatory to create github releases | |
contents: write | |
steps: | |
- name: Checkout main | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 0 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v5 | |
with: | |
python-version: '3.12' | |
- name: Check if the commit has a vx.y.z tag | |
id: check-version | |
run: | | |
if git tag --list --points-at ${{ github.sha }} | grep -q -E '^v[0-9]+\.[0-9]+\.[0-9]+$'; then | |
echo "is new version" | |
echo "should_continue=true" >> "$GITHUB_OUTPUT" | |
else | |
echo "is not a new version" | |
echo "should_continue=false" >> "$GITHUB_OUTPUT" | |
fi | |
- run: uv pip install hatch scriv | |
- name: build package | |
run: hatch build | |
- name: Publish package distributions to PyPI | |
if: ${{ steps.check-version.outputs.should_continue == 'true' }} | |
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4 | |
- name: create github release | |
if: ${{ steps.check-version.outputs.should_continue == 'true' }} | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
run: scriv github-release |