Skip to content

Commit

Permalink
Revert "fix(docs): Replace offline docs build action (#2050)"
Browse files Browse the repository at this point in the history
This reverts commit abd8abb.
  • Loading branch information
KyleGospo committed Jan 2, 2025
1 parent abd8abb commit 1a250e0
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: KyleGospo/docs.bazzite.gg/.github/workflows/build_mkdocs@main
uses: ./.github/workflows/build_mkdocs
continue-on-error: true
with:
github_token: ${{ github.token }}
Expand Down
95 changes: 95 additions & 0 deletions .github/workflows/build_mkdocs/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
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 }}

0 comments on commit 1a250e0

Please sign in to comment.