[skip docs commands update] Update commands documentation #40
Workflow file for this run
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: Build, validate, publish, version documentation for GitHub Pages | |
on: | |
push: | |
branches: | |
- master | |
- develop | |
- feature/* | |
- release/* | |
- hotfix/* | |
jobs: | |
docs-publish: | |
name: Build, validate, publish, version documentation for GitHub Pages | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install Python dependencies | |
run: pip install -r docs/requirements.txt | |
- name: Build, validate documentation using MkDocs | |
run: | | |
mkdocs build --clean --strict | |
rm -r site/ | |
- name: Build, publish, version documentation using Mike (only for master) | |
if: github.ref == 'refs/heads/master' | |
run: | | |
# constants for selecting branches | |
readonly GITHUB_ORG="${GITHUB_REPOSITORY_OWNER}" | |
function resolve_release_envs() { | |
echo "Git commit message:" | |
GIT_COMMIT_MSG="$(git log -1 --pretty=format:"%s")" | |
echo "${GIT_COMMIT_MSG}" | |
if [[ ! "${GIT_COMMIT_MSG}" =~ ^Merge\ pull\ request\ #[0-9]+\ from\ ${GITHUB_ORG}/(hotfix|release)/(v[0-9]+\.[0-9]+\.[0-9]+)$ ]]; then | |
>&2 echo "Pushes to master should be done via merges of PR requests from hotfix/vN.N.N or release/vN.N.N branches only." | |
>&2 echo "The expected message format (will be used for parsing a release tag):" | |
>&2 echo "Merge pull request #N from ${GITHUB_ORG}/hotfix/vN.N.N or ${GITHUB_ORG}/release/vN.N.N." | |
exit 1 | |
fi | |
VERSION="${BASH_REMATCH[2]}" | |
} | |
echo "Configure Git user.name and user.email." | |
git config user.name github-actions | |
git config user.email [email protected] | |
echo "Publish documentation" | |
resolve_release_envs | |
mike deploy --update-aliases --push --rebase "${VERSION}" latest |