Merge pull request #417 from onelapahead/crds-docs #248
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docs Site | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'doc-site/docs/**' | |
pull_request: | |
paths: | |
- 'doc-site/docs/**' | |
release: | |
types: [released] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
LATEST_TAG: "" | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
# Set up Go | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.22' | |
check-latest: true | |
cache-dependency-path: | | |
**/*.sum | |
- name: Setup Docs Deploy | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "[email protected]" | |
- name: Get the latest tag | |
run: | | |
git fetch --tags | |
latest_tag=$(git tag -l | sort -V | grep -v "rc" | tail -n 1) | |
echo "latest tag: $latest_tag" | |
echo "LATEST_TAG=$latest_tag" >> $GITHUB_ENV | |
- name: Install docs dependencies | |
working-directory: doc-site | |
run: pip install -r requirements.txt | |
- name: Build CRD Reference Docs | |
working-directory: operator | |
run: make generate-reference-docs | |
- name: Update doc site for release | |
if: github.event.action == 'released' && github.ref_name != env.LATEST_TAG | |
working-directory: doc-site | |
run: mike deploy ${{ github.event.release.tag_name }} --push | |
- name: Update doc site for latest release | |
if: github.event.action == 'released' && github.ref_name == env.LATEST_TAG | |
working-directory: doc-site | |
run: mike deploy ${{ github.event.release.tag_name }} latest -u --push | |
- name: Update doc site for `main` branch | |
if: ${{ github.event_name == 'push' }} | |
working-directory: doc-site | |
run: mike deploy head --push | |
- name: Test building the doc site but do not deploy it | |
if: ${{ github.event_name == 'pull_request' }} | |
working-directory: doc-site | |
run: mkdocs build |