mirror of
https://github.com/ublue-os/bazzite.git
synced 2025-01-04 02:40:05 +00:00
95094c381e
* chore(docs): fix cmdrun breaking image url replacement * ci(docs): Trigger deploy_docs with any change in docs dir
99 lines
2.7 KiB
YAML
99 lines
2.7 KiB
YAML
name: Deploy documentation
|
|
|
|
# Check for reference:
|
|
# https://github.com/s1rius/ezlog/blob/20dce11e6d324bb18f57dc7c7c6d4a8bf40064de/.github/workflows/publish_pages.yml
|
|
|
|
on:
|
|
schedule:
|
|
- cron: "40 03 */2 * *" # Runs at 03:40, every 2 days
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- docs/**
|
|
- .github/workflows/deploy_docs.yml
|
|
- README*.md
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: pages
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
runner: ubuntu-latest
|
|
cache-mkdocs-key: cache-mkdocs
|
|
SITE_SUFFIX: /bazzite/
|
|
REPO_URL: ${{ github.server_url }}/${{ github.repository }}
|
|
|
|
jobs:
|
|
deploy:
|
|
permissions:
|
|
contents: read # To push a branch
|
|
pages: write # To push to a GitHub Pages site
|
|
id-token: write # To update the deployment status
|
|
|
|
runs-on: ubuntu-latest
|
|
# environment:
|
|
# name: github-pages
|
|
# url: ${{ steps.deployment.outputs.page_url }}
|
|
defaults:
|
|
run:
|
|
working-directory: ./docs
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Prepare env vars
|
|
run: |
|
|
_OWNER_NAME=${{ github.repository_owner }}
|
|
_OWNER_NAME=${_OWNER_NAME,,}
|
|
_SITE_PREFIX=${{ env.SITE_SUFFIX }}
|
|
_SITE_PREFIX=${_SITE_PREFIX#/}
|
|
echo "SITE_URL=https://${_OWNER_NAME}.github.io/$_SITE_PREFIX" >> $GITHUB_ENV
|
|
|
|
# Necessary in order to have fetch_discourse_md.py available for mdbook-cmd
|
|
- name: Add docs/utils to PATH
|
|
run: |
|
|
echo $PWD/utils:$PATH >> $GITHUB_PATH
|
|
|
|
- name: Build book
|
|
uses: ./.github/workflows/build_mkdocs
|
|
with:
|
|
site_url: ${{ env.SITE_URL }}
|
|
repo_url: ${{ env.REPO_URL }}
|
|
working_dir: ${{ github.workspace }}/docs
|
|
output_dir: ${{ github.workspace }}/book
|
|
upload_github_page: "true"
|
|
github_token: ${{ github.token }}
|
|
|
|
clean_cache:
|
|
needs: deploy
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
actions: write
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Cache Cleanup
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
run: |
|
|
set -x
|
|
old_caches=($(gh cache list \
|
|
--repo ${{ github.repository }} \
|
|
--key "${{ runner.os }}-build-${{ env.cache-mkdocs-key }}-" \
|
|
--sort created_at -O asc --json id | jq '.[:-1][].id'))
|
|
for id in "${old_caches[@]}"; do
|
|
gh cache delete $id
|
|
done
|
|
- name: Remove Page Artifacts
|
|
uses: remagpie/gha-remove-artifact@v1
|
|
with:
|
|
only-name: github-pages
|
|
max-age: 7776000 # 90 days
|
|
max-count: 50
|