Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 46 additions & 9 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ name: Documentation

on:
workflow_dispatch:
inputs:
purge:
description: "Purge existing bundles and regenerate from scratch"
type: boolean
default: false
schedule:
# Run once every week on Sunday
- cron: 0 0 * * 0
Expand All @@ -12,6 +17,14 @@ on:
# Manual trigger
- 'trigger.txt'

env:
# sourcemod-dev/docgen commit chumbucket is built from
# Bundles are purged and regenerated from scratch whenever this changes
DOCGEN_REF: "e3b1c42c2e834b0e7ecc6102ecf2e419cca56c40"

permissions:
contents: write

jobs:
documentation:
name: Build Documentations
Expand All @@ -20,26 +33,50 @@ jobs:

steps:
- name: Checkout manifests
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
ref: "master"
path: "manifests"

- name: Checkout bundles
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
ref: "bundles"
path: "bundles"

- name: Download Chumbucket
uses: dsaltares/fetch-gh-release-asset@master
- name: Checkout docgen
uses: actions/checkout@v4
with:
repository: "sourcemod-dev/docgen"
ref: ${{ env.DOCGEN_REF }}
path: "docgen"
persist-credentials: false

- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable

- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
repo: "sourcemod-dev/docgen"
version: "tags/cb-0.4.3"
file: "chumbucket"
workspaces: "docgen"

- name: Build Chumbucket
working-directory: docgen
run: |
cargo build --release --locked -p chumbucket
cp target/release/chumbucket ../chumbucket

- name: Purge bundles
env:
PURGE: ${{ inputs.purge }}
run: |
# Bundles from an older docgen are not continued from, as their history and dates may differ
if [ "$PURGE" = "true" ] || [ "$(cat bundles/.docgen 2>/dev/null)" != "$DOCGEN_REF" ]; then
echo "Purging existing bundles"
rm -f bundles/*.bundle bundles/index
fi

- name: Chumbucket +x
run: sudo chmod +x chumbucket
echo "$DOCGEN_REF" > bundles/.docgen

- name: Process manifests
run: |
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ patterns = [
All the manifest files are processed by the documentation generator via cron (every Sunday) or file trigger.

Manifest files are processed and converted to bundle files in the `bundles` branch that will be consumed by the CDN

`chumbucket` is built from the [docgen](https://github.com/sourcemod-dev/docgen) commit pinned by `DOCGEN_REF` in the documentation workflow. Changing that commit purges the existing bundles and regenerates them from scratch. A purge can also be requested by running the workflow manually with the `purge` input.
1 change: 1 addition & 0 deletions trigger.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ more metadata!
production!!!
deletion handling, thanks ash!!!
purge, regen
tree-sitter docgen, purge, regen