Skip to content

Commit

Permalink
ci: build package before checking version
Browse files Browse the repository at this point in the history
the version is only available after running poetry build. also remove the current dir from the path, to force the import of the built package
  • Loading branch information
moldhouse committed Nov 4, 2024
1 parent cfb997e commit 4351536
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,22 @@ jobs:
- 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: |
pushd aleph_alpha_client
python -c "from version import __version__; \
python -c "import sys; sys.path.pop(0); \
import aleph_alpha_client; \
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.'"
popd
- name: Setup Poetry
uses: Gr1N/setup-poetry@v9
- name: Install deps
run: poetry install
assert aleph_alpha_client.__version__ == git_version, \
f'versions do not match {aleph_alpha_client.__version__} vs. {git_version}. Please update version.py to match the git Release tag.'"
- name: Build
run: poetry build
- name: Publish
Expand Down

0 comments on commit 4351536

Please sign in to comment.