Skip to content

publish to pypi

publish to pypi #8

Workflow file for this run

name: Upload Python Package to PyPI when a Release is Created
on:
# release:
# types: [created]
push:
env:
PREFIX: /tmp
jobs:
pypi-publish:
name: Publish release to PyPI
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/pysjef
permissions:
id-token: write
contents: read
packages: write
# container:
# image: ghcr.io/${{ github.repository }}
# credentials:
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Set up miniconda
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: "3.x"
- name: Conda info
shell: bash -el {0}
run: |
conda info
conda list
- name: Build sjef
run: |
cmake -B cmake-build -S . -DCMAKE_INSTALL_PREFIX=$PREFIX -DBUILD_TESTS=OFF -DBUILD_PROGRAM=OFF -DCMAKE_CXX_FLAGS=-fPIC
cmake --build cmake-build -t install
grep CMAKE_PROJECT_VERSION: cmake-build/CMakeCache.txt | sed -e 's/.*=/__version__ = "/' -e 's/$/"/' > pysjef/pysjef/_version.py
- name: Install dependencies
run: |
python -m venv /tmp/venv
PATH=/tmp/venv/bin:$PATH
python -m pip install --upgrade pip
pip install setuptools wheel cython
- name: Build package
run: |
cd pysjef
PATH=/tmp/venv/bin:$PATH
python setup.py sdist bdist_wheel # Could also be python -m build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1