mirror of
https://github.com/ublue-os/bazzite.git
synced 2025-01-01 03:21:41 +00:00
96 lines
2.5 KiB
YAML
96 lines
2.5 KiB
YAML
name: Build mkdocs
|
|
description: Parametrized mkdocs building
|
|
|
|
inputs:
|
|
github_token:
|
|
description: github token
|
|
required: true
|
|
|
|
site_url:
|
|
description: Set `MKDOCS_SITE_URL` env var
|
|
default: ""
|
|
required: true
|
|
|
|
working_dir:
|
|
description: Parent directory that contains mkdocs.yml
|
|
default: ${{ github.workspace }}/docs
|
|
|
|
output_dir:
|
|
description: Where we will output the resulting webpage
|
|
default: ${{ github.workspace }}/book
|
|
|
|
upload_github_page:
|
|
description: Upload github-page
|
|
default: "false"
|
|
|
|
repo_url:
|
|
description: URL of the repo
|
|
default: ${{ github.server_url }}/${{ github.repository }}
|
|
|
|
outputs:
|
|
artifact_id:
|
|
description: "Artifact id uploaded (is an empty string in case of `upload_github_page: false`)"
|
|
value: ${{ steps.upload-artifact.outputs.artifact_id }}
|
|
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.12"
|
|
|
|
- name: Install Poetry
|
|
uses: abatilo/actions-poetry@v2
|
|
|
|
- name: Configure Poetry
|
|
working-directory: ${{ inputs.working_dir }}
|
|
shell: bash
|
|
run: |
|
|
poetry config virtualenvs.create true --local
|
|
poetry config virtualenvs.in-project true --local
|
|
|
|
- name: Poetry install deps
|
|
shell: bash
|
|
working-directory: ${{ inputs.working_dir }}
|
|
run: poetry install
|
|
|
|
- name: Build book
|
|
shell: bash
|
|
working-directory: ${{ inputs.working_dir }}
|
|
env:
|
|
MKDOCS_SITE_URL: ${{ inputs.site_url }}
|
|
MKDOCS_REPO_URL: ${{ inputs.repo_url }}
|
|
_OUTPUT_DIR: ${{ inputs.output_dir }}
|
|
run: |
|
|
source .venv/bin/activate
|
|
max_tries=3
|
|
is_ok=0
|
|
while [[ $max_tries -gt 0 && is_ok -ne 1 ]]; do
|
|
if ! mkdocs build --verbose -d $_OUTPUT_DIR; then
|
|
max_tries=$(( $max_tries -1 ))
|
|
else
|
|
is_ok=1
|
|
fi
|
|
done
|
|
|
|
- name: Setup Pages
|
|
if: ${{ inputs.upload_github_page == 'true' }}
|
|
uses: actions/configure-pages@v4
|
|
with:
|
|
token: ${{ inputs.github_token }}
|
|
|
|
- name: Upload artifact
|
|
if: ${{ inputs.upload_github_page == 'true' }}
|
|
uses: actions/upload-pages-artifact@v3
|
|
id: upload-artifact
|
|
with:
|
|
path: ${{ inputs.output_dir }}
|
|
token: ${{ inputs.github_token }}
|
|
|
|
- name: Deploy to GitHub Pages
|
|
if: ${{ inputs.upload_github_page == 'true' }}
|
|
id: deployment
|
|
uses: actions/deploy-pages@v4
|
|
with:
|
|
token: ${{ inputs.github_token }}
|