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: MkDocs Build + Deploy | |
on: | |
push: | |
branches: | |
- main # Set the branch you want to trigger the workflow on | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install mkdocs mkdocs-material pymdown-extensions | |
- name: Build MkDocs | |
run: mkdocs build --clean | |
- name: Create and force push to documentation branch | |
run: | | |
git config user.name "${{ github.actor }}" | |
git config user.email "${{ github.actor }}@users.noreply.github.com" | |
# git checkout -b production | |
# find . -type f ! -path './site*' ! -path './.*' -exec echo {} + | |
# find . -type f ! -path './site*' ! -path './.*' -exec rm -f {} + | |
# rm -rf docs | |
# mv site docs | |
# touch .nojekyll | |
# git add . | |
# git commit -m "Content update" | |
# Fetch and pull changes from the remote "production" branch: | |
git fetch origin production | |
git branch --set-upstream-to=origin/production production | |
git pull --rebase | |
# Update the production branch with force push | |
git checkout origin/production | |
git rm */* | |
git checkout main -- site | |
git mv site docs | |
git push origin/production |