-
Notifications
You must be signed in to change notification settings - Fork 189
36 lines (32 loc) · 1 KB
/
publish-to-pypi.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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