Skip to content

Commit

Permalink
Automated versioned documentation publication (#182) (#183)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomklapiscak authored and Tom Klapiscak committed Aug 22, 2024
1 parent 0bbbbdf commit 497ebb4
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 21 deletions.
42 changes: 29 additions & 13 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,40 @@
name: Build Documentation
on:
push:
tags: [ '*.*.*' ]
branches:
- '**'
tags-ignore:
- '**'
- main
- dev

jobs:
deploy-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]

- name: Install and Build
- name: Install Python dependencies
run: |
bash build/bin/build-docs.sh
python -m pip install -q mkdocs
python -m pip install -q mkdocs-redirects
python -m pip install -q mkdocs-macros-plugin
python -m pip install -q mkdocs-drawio-file
python -m pip install -q mike
- name: Checkout
uses: actions/checkout@v4

# GITHUB_REF is one of the following: "refs/heads/main", "refs/heads/dev", "refs/tags/x.x.x"
# We use this to determine the version of documentation that we want to publish; one of: "main", "dev" or "x.x"
# Note: the latter is deliberately "x.x" (not "x.x.x") so we group docs by minor release; each version of the docs will correspond to the latest patch release for that minor version.
# The command uses sed/regex to pull out "main", "dev" or "x.x" and assign it to the "branch" output of this step, accessible in later steps via ${{ steps.get_branch_name.outputs.branch }}"
- name: Get branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF} | sed -rn "s/refs\/(tags\/([0-9]+\.[0-9]+).*|heads\/(.*))/\2\3/p")"
id: get_branch_name

- name: Deploy
uses: JamesIves/[email protected]
if: github.ref == 'refs/heads/main'
with:
branch: gh-pages
folder: site
- name: Deploy with mike 🚀
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git fetch origin gh-pages --depth=1
echo "Pushing docs for version ${{ steps.get_branch_name.outputs.branch }}"
mike deploy --push ${{ steps.get_branch_name.outputs.branch }}
6 changes: 0 additions & 6 deletions build/bin/build-docs.sh

This file was deleted.

2 changes: 0 additions & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# mkdocs serve

site_name: MAS GitOps
site_url: https://pages.github.com/ibm-mas/gitops

Expand Down

0 comments on commit 497ebb4

Please sign in to comment.