From 145d809477273ff7d9b7735f9a2c8c40de33f9b2 Mon Sep 17 00:00:00 2001 From: Arnav Choudhury Date: Wed, 22 Dec 2021 15:23:48 +0530 Subject: [PATCH] Updated docs to build and manage and show version based github pages docs --- .github/workflows/docs.yaml | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 86beec52ae..b082373cb1 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -2,13 +2,21 @@ name: Build and deploy docs on: push: - branches: [master] + branches: + - "master" + # Push events to branches matching + # refs/heads/stable/2.5 + # refs/heads/stable/10 + # refs/heads/stable/2 + # refs/heads/stable/2.5.6 + - "stable/[0-9]+(.[0-9])*(.[0-9])*" workflow_dispatch: # to trigger manually env: POETRY_VERSION: "1.1.11" POETRY_VIRTUALENVS_IN_PROJECT: "1" + LATEST_STABLE_BRANCH: "stable/2.5" jobs: @@ -49,5 +57,19 @@ jobs: - name: Install dependencies run: poetry install -E docs - - name: Deploy docs to Github Pages - run: poetry run mkdocs gh-deploy --force + - name: Configure git user to make commit + run: | + git config user.name "Arnav Choudhury" + git config user.email "arnav13@gmail.com" + + - name: Fetch gh-pages remote changes (if any) + run: git fetch origin gh-pages --depth=1 + + - name: Deploy (and Update) docs for the branch, ${GITHUB_REF##*/} + run: poetry run mike deploy --push --rebase "${GITHUB_REF##*/}" + + - name: Set default docs to ${LATEST_STABLE_BRANCH##*/} + run: poetry run mike set-default --push --rebase "${LATEST_STABLE_BRANCH##*/}" + + +