wiki-updater #796
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: wiki-updater | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '30 0 * * *' | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
jobs: | |
deploy: | |
name: Build mkdocs wiki | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout latest code from main branch | |
uses: actions/checkout@v3 | |
- name: Installing Python v3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Install mkdocs and dependencies | |
run: pip install mkdocs mkdocs-material fontawesome_markdown mdx_unimoji mkdocs-mermaid2-plugin pymdown-extensions plantuml-markdown python-markdown-math | |
- name: Inject the custom domain | |
# Refer | |
# - https://github.com/tschaub/gh-pages/issues/213 | |
# - https://github.com/mkdocs/mkdocs/issues/1377 | |
env: | |
WIKI_DOMAIN: ${{ secrets.CUSTOM_DOMAIN }} | |
run: echo ${WIKI_DOMAIN} > docs/CNAME | |
- name: Generate Documentation | |
run: mkdocs build | |
- name: Upload Artifacts when pushed to branch | |
uses: actions/upload-artifact@v3 | |
if: ${{ github.event_name == 'push'}} | |
with: | |
name: site | |
path: ./site | |
- name: Upload Artifacts when ran manually | |
uses: actions/upload-artifact@v3 | |
if: ${{ github.event_name == 'schedule'}} | |
with: | |
name: site | |
path: ./site | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./site |