ci: Fix invalid workflow syntax #20
This file contains 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: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
lint-and-test: | |
name: Lint and Test | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install hatch | |
run: | | |
python -m pip install hatch | |
- name: Lint | |
run: hatch run lint:check | |
- name: Tests | |
run: hatch run +py=${{ matrix.python-version }} test:test | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
needs: lint-and-test | |
permissions: | |
id-token: write | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11 | |
- name: Python Semantic Release | |
id: release | |
uses: python-semantic-release/python-semantic-release@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
changelog: 'false' | |
prerelease: 'false' | |
- name: Install hatch | |
run: | | |
python -m pip install hatch | |
- name: Update Version with Hatch | |
if: steps.release.outputs.released == 'true' | |
run: | | |
echo "Updating version to ${{ steps.release.outputs.version }}" | |
hatch version ${{ steps.release.outputs.version }} | |
- name: Build | |
run: hatch build | |
- name: Publish on PyPI | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.release.outputs.released == 'true' | |
run: hatch publish | |
env: | |
HATCH_INDEX_USER: __token__ | |
HATCH_INDEX_AUTH: ${{ secrets.HATCH_INDEX_AUTH }} |