Skip to content

Merge pull request #255 from oqc-community/improvement/ker/gate_suppo… #114

Merge pull request #255 from oqc-community/improvement/ker/gate_suppo…

Merge pull request #255 from oqc-community/improvement/ker/gate_suppo… #114

Workflow file for this run

name: Publish documentation
on:
push:
tags:
- "*"
branches:
- main
workflow_dispatch:
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
environment: "applications - github"
steps:
- name: Checkout
uses: actions/checkout@v3.5.2
- name: Setup Python
uses: actions/setup-python@v4.6.0
- name: cache poetry install
uses: actions/cache@v2
with:
key: poetry-1.4.1-0
path: ~/.local
- name: Install Poetry Action
uses: snok/install-poetry@v1.3.3
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: cache deps
id: cache-deps
uses: actions/cache@v2
with:
path: .venv
key: pydeps-${{ hashFiles('**/poetry.lock') }}
- run: poetry install --no-interaction --no-root --with docs
if: steps.cache-deps.outputs.cache-hit != 'true'
- run: poetry install --no-interaction
- name: Build docs
if: github.ref_type == 'branch'
run: |
git config --global user.email "GithubActions@oqc-community.com"
git config --global user.name "Github Actions"
git fetch --all
git checkout ${{ steps.extract_branch.outputs.branch }}
rm -rf .gitignore
poetry run sphinx-apidoc -f -M -e -o docs/source/ src
git add .
git commit -m "temporarily commiting api docs"
poetry run sphinx-multiversion docs/source/ docs/build/
- name: Extract tag name
if: github.ref_type == 'tag'
run: echo "tag=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/tags/}}" >> $GITHUB_OUTPUT
id: extract_tag
- name: Check poetry and docs version matches tag
if: github.ref_type == 'tag'
run: |
POETRY_VERSION=$(poetry version -s)
TAG=$(echo $GITHUB_REF | cut -d / -f 3)
DOCS_VERSION=$(grep -oP 'version = "\K.*?(?=")' docs/source/conf.py)
[[ $POETRY_VERSION = $TAG && $DOCS_VERSION = $TAG ]]
- name: Build docs - tag
if: github.ref_type == 'tag'
run: |
git config --global user.email "GithubActions@oqc-community.com"
git config --global user.name "Github Actions"
git fetch --all
git checkout ${{ steps.extract_branch.outputs.branch }} -b ${{ steps.extract_tag.outputs.tag }}
rm -rf .gitignore
poetry run sphinx-apidoc -f -M -e -o docs/source/ src
git add --force .
git commit -a -m "temporarily commiting api docs"
poetry run sphinx-multiversion docs/source/ docs/build/
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: docs/build
clean: false