Build docs #60734
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
# This is a basic workflow to help you get started with Actions | |
name: Build docs | |
on: | |
# Triggers the workflow on push or pull request events but only for the develop branch | |
push: | |
branches: [ develop ] | |
paths-ignore: | |
- 'docs/packages/**' | |
- 'mkdocs.yml' | |
- '.github/**' | |
pull_request: | |
branches: [ develop ] | |
paths-ignore: | |
- 'docs/packages/**' | |
- 'mkdocs.yml' | |
- '.github/**' | |
schedule: | |
- cron: "*/30 * * * *" | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
inputs: | |
commit_message: | |
# Friendly description to be shown in the UI instead of 'name' | |
description: 'Git commit message if changes are found.' | |
# Default value if no value is explicitly provided | |
default: 'Generated by build-docs workflow.' | |
# Input has to be provided for the workflow to run | |
required: true | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
build: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- name: checkout docs | |
uses: actions/checkout@v2 | |
with: | |
path: docs | |
# Blow away docs/pacakges and mkdocs.yml, run build script and commit. | |
- name: prepare for running "bin/the_final_markdown.sh" | |
run: | | |
cd $GITHUB_WORKSPACE/docs | |
rm -rf docs/packages mkdocs.yml | |
pip install -r docs/requirements.txt | |
bin/the_final_markdown.sh | tee $GITHUB_WORKSPACE/build_log.txt | |
date >> $GITHUB_WORKSPACE/build_log.txt | |
git config user.name github-actions | |
git config user.email [email protected] | |
git add . | |
COMMIT_MSG="\"${{ github.event.inputs.commit_message }}\"" | |
COMMIT_MSG=${COMMIT_MSG:="\"Generated by build-docs workflow.\""} | |
git diff-index --quiet HEAD && echo "No changes found in generated docs, exit now without commit." >> $GITHUB_WORKSPACE/build_log.txt || (git commit -m "$COMMIT_MSG" && git push) | |
- name: upload build log | |
uses: actions/upload-artifact@v4 | |
with: | |
name: docs build log | |
path: ${{ github.workspace }}/build_log.txt |