-
Notifications
You must be signed in to change notification settings - Fork 22
33 lines (31 loc) · 1.08 KB
/
python-publish.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
name: Upload Python Package
on:
release:
types: [published]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Setup Poetry
uses: Gr1N/setup-poetry@v9
- name: Install deps
run: poetry install
- name: Assert tag version matches __version__ attribute
run: |
poetry run python -c "import sys; sys.path.pop(0); \
from aleph_alpha_client import __version__; \
git_ref = '${GITHUB_REF#refs/}'; \
assert git_ref.startswith('tags'), \
f'{git_ref} is not a version tag'; \
git_version = '${GITHUB_REF#refs/tags/}'[1:]; \
assert __version__ == git_version, \
f'versions do not match {__version__} vs. {git_version}. Please update version.py to match the git Release tag.'"
- name: Build
run: poetry build
- name: Publish
run: poetry publish -u __token__ -p ${{ secrets.PYPI_API_TOKEN }}