Merge pull request #214 from nerc-project/new_status #736
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 and Deploy Documentation using MkDocs | |
# Controls when the action will run. Triggers the workflow on push events on main branch | |
# but pull request events on any branch but deployement happens only for the main branch | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
# branches: [main] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# permissions: | |
# contents: read | |
jobs: | |
build: | |
name: Build Documentation | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [3.10.12] | |
steps: | |
- name: Checkout Main | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies and setup git config | |
run: | | |
python -m pip install --upgrade pip | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
git config user.name 'github-actions[bot]' && git config user.email 'github-actions[bot]@users.noreply.github.com' | |
- name: Clean Build | |
run: | | |
mkdocs build --clean | |
deploy: | |
name: Deploy Documentation | |
needs: build | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [3.10.12] | |
# this part will only run if the PR has been merged | |
# if: github.event.pull_request.merged == true | |
# this part will only run if the branch or tag ref | |
# that triggered the workflow is main i.e. pushed or PR merged in main | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: Checkout Main | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies and setup git config | |
run: | | |
python -m pip install --upgrade pip | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
git config user.name 'github-actions[bot]' && git config user.email 'github-actions[bot]@users.noreply.github.com' | |
- name: Deploy | |
run: | | |
mkdocs gh-deploy --force |