v0.1.12 #13
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 | |
environment: | |
name: pypi | |
url: https://pypi.org/p/foamlib | |
permissions: | |
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install needed packages | |
run: | | |
pip install --upgrade setuptools build | |
- name: Check version number | |
run: | | |
TAG="${GITHUB_REF#refs/tags/}" | |
VERSION_FROM_TAG="${TAG#v}" | |
PACKAGE_VERSION=$(python -c 'import setuptools; setuptools.setup()' --version) | |
if [ "$PACKAGE_VERSION" != "$VERSION_FROM_TAG" ]; then | |
echo "::error title=Version mismatch::$PACKAGE_VERSION (package version) != $VERSION_FROM_TAG (version from tag)" | |
exit | |
fi | |
- name: Build | |
run: | | |
python -m build | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |