mirror of
https://github.com/ublue-os/bazzite.git
synced 2025-01-31 06:32:57 +00:00
fix(docs): Replace offline docs build action (#2050)
This centralizes the logic to build the docs in a single repo (https://github.com/KyleGospo/docs.bazzite.gg) and fixes offline docs not building
This commit is contained in:
parent
67686f7193
commit
abd8abbf93
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@ -173,7 +173,7 @@ jobs:
|
||||
run: rm -r ${{ github.workspace }}/docs && git clone https://github.com/KyleGospo/docs.bazzite.gg.git ${{ github.workspace }}/docs
|
||||
continue-on-error: true
|
||||
- name: Build offline documentation
|
||||
uses: ./.github/workflows/build_mkdocs
|
||||
uses: KyleGospo/docs.bazzite.gg/.github/workflows/build_mkdocs@main
|
||||
continue-on-error: true
|
||||
with:
|
||||
github_token: ${{ github.token }}
|
||||
|
95
.github/workflows/build_mkdocs/action.yml
vendored
95
.github/workflows/build_mkdocs/action.yml
vendored
@ -1,95 +0,0 @@
|
||||
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 }}
|
Loading…
x
Reference in New Issue
Block a user