Skip to content
name: (Auto-On-Release) Deploy Docs and PyPI
on:
release:
types: [published]
jobs:
# Job (1): Build and deploy docs.
docs:
name: Build docs and auto-examples
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- name: Download and setup Miniconda
uses: conda-incubator/setup-miniconda@v3
with:
miniconda-version: "latest"
python-version: 3.8
- name: Checkout Code
uses: actions/checkout@v2
- name: Install Dependencies
run: |
conda activate test
conda env list
pip install -r requirements-dev.txt
pip install -r optional-dependencies.txt
- name: Build docs
run: |
cd docs
make clean
make html
touch _build/html/.nojekyll
echo 'nltools.org' > _build/html/CNAME
- name: Deploy docs
if: success()
uses: crazy-max/ghaction-github-pages@v2
with:
target_branch: gh-pages
build_dir: docs/_build/html
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Job (2): Build package and upload to pypi
deploy:
name: Build & deploy package
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: "3.8"
- name: Pypa build
run: |
python3 -m pip install build --user
- name: Wheel and source build
run: |
python3 -m build --sdist --wheel --outdir dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_API_TOKEN }}