Upload Python Package #92
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: 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 }} |