Skip to content

doc: fixup module layout #17

doc: fixup module layout

doc: fixup module layout #17

Workflow file for this run

name: "Update documentation"
permissions:
contents: read
on:
push:
tags:
- v*
branches: [ "master" ]
paths:
- docs/**
- hack/doc-site/**
- .github/workflows/update-doc.yml
pull_request:
paths:
- docs/**
- hack/doc-site/**
- .github/workflows/update-doc.yml
concurrency:
group: "pages"
cancel-in-progress: false
defaults:
run:
shell: bash
jobs:
build-doc:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: '1'
submodules: recursive
sparse-checkout: |
hack/
docs/
-
name: Get all tags [go-openapi repo]
if: ${{ github.repository == 'go-openapi/runtime' }}
run: |
git fetch origin --prune --update-shallow --tags 'refs/tags/*:refs/tags/*'
-
name: Get all tags [fork]
if: ${{ github.repository != 'go-openapi/runtime' }}
run: |
git remote add upstream "https://github.com/go-openapi/runtime"
git fetch upstream --prune --update-shallow --tags 'refs/tags/*:refs/tags/*'
git fetch origin --prune --update-shallow --tags 'refs/tags/*:refs/tags/*'
-
name: Initialize theme
env:
RELEARN_VERSION: 9.0.3
run: |
cd hack/doc-site/hugo
# Clone theme
curl -sL -o relearn.tgz https://github.com/McShelby/hugo-theme-relearn/archive/refs/tags/"${RELEARN_VERSION}".tar.gz
tar xf relearn.tgz
rm -rf themes/hugo-relearn
mv "hugo-theme-relearn-${RELEARN_VERSION}" hugo-relearn
mv hugo-relearn themes/
-
name: Prepare config
run: |
# Builds a commit-dependant extra config to inject parameterization.
# HUGO doesn't support config from the command line.
#
# Set specific parameters that are used in some parameterized document.
# This is used to keep up-to-date installation instructions.
cd hack/doc-site/hugo
ROOT=$(git rev-parse --show-toplevel)
VERSION_MESSAGE="Documentation set for latest master."
REQUIRED_GO_VERSION=$(grep "^go\s" "${ROOT}"/go.mod|cut -d" " -f2)
LATEST_RELEASE=$(git tag --list --sort -version:refname 'v*' 2>/dev/null | head -1 || echo "dev")
BUILD_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
echo " Latest release: ${LATEST_RELEASE}"
echo " Go version: ${REQUIRED_GO_VERSION}"
echo " Build time: ${BUILD_TIME}"
echo " Version message: ${VERSION_MESSAGE}"
# Generate dynamic config
cat runtime.yaml.template \
| sed "s|{{ GO_VERSION }}|${REQUIRED_GO_VERSION}|g" \
| sed "s|{{ LATEST_RELEASE }}|${LATEST_RELEASE}|g" \
| sed "s|{{ VERSION_MESSAGE }}|${VERSION_MESSAGE}|g" \
| sed "s|{{ BUILD_TIME }}|${BUILD_TIME}|g" \
> runtime.yaml
-
name: Build site with Hugo
uses: crazy-max/ghaction-hugo@d629f74d3e4a9da53050610da35a59863ab9b26c # v3.3.0
with:
version: v0.153.3 # <- pin the HUGO version, as they often break things
extended: true
args: >
--config hugo.yaml,runtime.yaml
--buildDrafts
--cleanDestinationDir
--minify
--printPathWarnings
--ignoreCache
--noBuildLock
--logLevel info
--source ${{ github.workspace }}/hack/doc-site/hugo
-
name: Upload artifact
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
with:
path: hack/doc-site/hugo/public
deploy-doc:
if: ${{ github.event_name != 'pull_request' }}
needs: build-doc
outputs:
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
-
name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0
-
name: Report URL
run: |
echo "::notice::Deployed doc site to ${{ steps.deployment.outputs.page_url }}"