diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 05a48e2..3cb4799 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -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 @@ -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 @@ -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: | diff --git a/README.md b/README.md index ec2e666..233fc25 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/trigger.txt b/trigger.txt index 73127fa..077ac4a 100644 --- a/trigger.txt +++ b/trigger.txt @@ -8,3 +8,4 @@ more metadata! production!!! deletion handling, thanks ash!!! purge, regen +tree-sitter docgen, purge, regen