Standalone build workflow to be used by publish workflow and on new PRs & linter fixes #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: Build distribution 📦 | |
on: | |
workflow_call: | |
workflow_dispatch: | |
pull_request: | |
jobs: | |
build-package: | |
runs-on: ubuntu-latest | |
steps: | |
- id: check_ref | |
run: echo "::set-output name=match::$(echo '${{ github.ref }}' | grep -Pq '^refs/tags/v\d+\.\d+\.\d+$' && echo true || echo false)" | |
shell: bash | |
- name: Check if tag is valid | |
if: steps.check_ref.outputs.match != 'true' | |
run: exit 1 | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Install hatch | |
run: | | |
pip install hatch --user | |
- name: Run tests | |
run: | | |
python3 -m hatch run test | |
- name: Run linting | |
run: | | |
python3 -m hatch run lint:all | |
- name: Build a wheel and a source tarball | |
run: | | |
python3 -m hatch build |