Skip to content

Upload Python Package to PyPI and Deploy Documentation to Read the Docs #18

Upload Python Package to PyPI and Deploy Documentation to Read the Docs

Upload Python Package to PyPI and Deploy Documentation to Read the Docs #18

Workflow file for this run

name: Upload Python Package to PyPI and Deploy Documentation to Read the Docs
on:
release:
types: [created]
jobs:
pypi-publish:
name: Publish release to PyPI and Deploy Documentation
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.12"
- name: Install Miniconda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
- name: Initialize Conda
run: |
conda init bash
shell: bash
- name: Create Conda environment
run: |
conda env create -f environment.yaml
- name: Activate Conda environment
run: |
source ~/.bashrc
conda activate MED3pa
shell: bash
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel setuptools-scm sphinx sphinx_rtd_theme
- name: Clean dist directory
run: |
rm -rf dist/
- name: Build package
run: |
python setup.py sdist bdist_wheel
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@v1.5.1 # Updated to the latest version
with:
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Build and deploy documentation to Read the Docs
run: |
pip install sphinx
cd docs
make html
sphinx-build -b html . _build/html
env:
READTHEDOCS: "True" # Ensure that the Read the Docs environment variable is set