Build and deploy documentation #77
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
# Clone OSW-OS, merge its documentation, build the result and publish it to GitHub Pages | |
name: Build and deploy documentation | |
env: | |
OSW_OS_DOCS_BRANCH: develop | |
on: | |
push: | |
branches: ["master"] | |
schedule: | |
- cron: "0 0 * * *" # Automatic daily rebuild, to keep the documentation up-to-date even if maintainers forget to trigger a rebuild manually | |
workflow_dispatch: | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Allow one concurrent deployment | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
jobs: | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
# uses: actions/checkout@v3 # incompatible with git lfs cache bandwidth calcs (https://github.com/actions/checkout/issues/165) | |
uses: nschloe/[email protected] | |
with: | |
submodules: recursive | |
- name: Install poetry | |
run: pipx install poetry | |
- name: Install dependencies | |
run: poetry install | |
- name: Clone and merge OSW-OS docs | |
run: poetry run .github/embed_osw_os_docs.py # uses rsync, which is preinstalled on this runner | |
- name: Build the documentation | |
run: poetry run mkdocs build -c -s -d public | |
- name: Block bots to avoid indexing | |
run: 'echo -e "User-agent: *\nDisallow: /" > public/robots.txt' | |
- name: Setup Pages | |
uses: actions/configure-pages@v2 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: "./public/" | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 |