Skip to content

Publish libeCalc package to PyPI #6

Publish libeCalc package to PyPI

Publish libeCalc package to PyPI #6

Workflow file for this run

name: Publish libeCalc package to PyPI
on:
workflow_call:
workflow_dispatch:
jobs:
publish:
environment:
name: testpypi
url: https://test.pypi.org/p/libecalc # TODO: test
#name: pypi
#url: https://pypi.org/project/libecalc/
permissions:
id-token: write # Required for Trusted Publishing to PyPI, the pypa action uses this
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# Make sure we publish from main branch, not the triggering ref
ref: ${{ github.event.repository.default_branch }}
- name: Setup Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
# TODO: Change to uv
- uses: snok/install-poetry@v1
with:
version: 1.8.4
virtualenvs-create: true
# TODO: Needed? Should have done waaaay earlier, ie. before we are allowed to create a new release
- name: Check pyproject.toml validity
run: poetry check --no-interaction
# TODO: Needed, we do this to validate? In case sth happened between the lock file was ok and now? withdrawn deps? To build, ie. find packages to allow building, prob. yes, but test to verify!
# - name: Cache dependencies
# id: cache-deps
# uses: actions/cache@v4
# with:
# path: ${{github.workspace}}/.venv
# key: poetry-${{ hashFiles('**/poetry.lock') }}
# restore-keys: poetry-
# - name: Install dependencies # if cache has changed
# if: steps.cache-deps.cache-hit != 'true'
# run: |
# poetry config virtualenvs.in-project true
# poetry install --no-interaction
- name: Build the libecalc package (wheel and sdist by default)
run: |
poetry build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
attestations: false
repository-url: https://test.pypi.org/legacy/
packages-dir: dist/