Skip to content

build and publish API docs #39

build and publish API docs

build and publish API docs #39

Workflow file for this run

name: publish-docs
run-name: build and publish API docs
on:
push:
# only build and publish docs on release-please tags
tags: ["v*"]
paths:
- "docs/**"
- "genome_kit/**"
- ".github/workflows/publish-docs.yaml"
- ".github/actions/**"
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: write
id-token: write
jobs:
build-and-publish-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/build-gk
with:
platform: linux-64
- name: restore mamba env
id: restore_mamba_cache
uses: actions/cache/restore@v4
with:
key: mamba-env-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/workflows/run-tests.yaml', '.github/actions/**') }}
path: |
~/micromamba
~/.condarc
~/bin/micromamba
fail-on-cache-miss: true
- name: restore the gk package tarballs
id: restore_gk_pkg
uses: actions/cache/restore@v4
with:
key: mamba-env-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/workflows/run-tests.yaml', '.github/actions/**', 'conda-recipe/meta.yaml', 'src/**', 'genome_kit/**') }}
path: |
~/conda-bld
fail-on-cache-miss: true
- name: create doc-build env
shell: bash -l -e {0}
run: |
set -x
pkg_name=$(eval ls -1 ~/conda-bld/*/*.tar.bz2 | head -1)
pkg_name=$(basename ${pkg_name})
pkg_version=$(echo $pkg_name | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+')
pkg_name=${pkg_name%%-[0-9]*}
micromamba activate build
conda index ~/conda-bld
mamba create -n doc-build -c file://${HOME}/conda-bld \
${pkg_name}=${pkg_version} \
m2r2 \
make \
myst-parser \
sphinx \
sphinx_rtd_theme
set +x
- name: build docs
shell: bash -l -e {0}
run: |
set -x
micromamba activate ~/micromamba/envs/build/envs/doc-build
make html -C docs-src
set +x
- name: push to gh-pages branch
shell: bash -l -e {0}
run: |
set -x
pkg_name=$(eval ls -1 ~/conda-bld/*/*.tar.bz2 | head -1)
pkg_name=$(basename ${pkg_name})
pkg_version=$(echo $pkg_name | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+')
git fetch origin
git checkout gh-pages
cp -r docs-src/_build/html/* docs/
mkdir -p docs/${pkg_version}/
cp -r docs-src/_build/html/* docs/${pkg_version}/
git status
git config --global user.email "[email protected]"
git config --global user.name "gh-actions-bot"
git add docs
git commit -m "docs: update to version ${pkg_version}"
git push origin gh-pages
set +x