Deploy to pypi #17
Workflow file for this run
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: Deploy to pypi | |
on: | |
release: | |
types: [created] | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
# Use the minimum Python version in pyproject.toml (later versions should maintain backwards-compatibility) | |
python-version: "3.10" | |
- name: check version | |
run: | | |
GIT_TAG=$(git describe --tags --exact-match 2>/dev/null || echo "No tag") | |
CODE_VERSION=v$(hatch version) | |
if [[ "$GIT_TAG" != "$CODE_VERSION" ]]; then | |
echo "version mismatch: $GIT_TAG and $CODE_VERSION" | |
exit 1 | |
fi | |
- name: Install dependencies | |
run: | | |
pip install . && pip install hatch | |
- name: Publish to PyPi | |
env: | |
HATCH_INDEX_USER: "__token__" | |
HATCH_INDEX_AUTH: ${{ secrets.PYPI_TOKEN }} | |
run: | | |
hatch build --clean && hatch publish |