schema-doc-update #61
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Update schema documentation" | |
on: | |
repository_dispatch: | |
types: [schema-doc-update] | |
jobs: | |
update-schema-docs: | |
name: "Update schema documentation" | |
runs-on: "ubuntu-latest" | |
permissions: write-all | |
env: | |
FROM_TAG: ${{ github.event.client_payload.tag }} | |
steps: | |
- name: "Checkout the repository (main)" | |
if: ${{ github.event.client_payload.tag == 'dev' }} | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
- name: "Checkout the repository (stable)" | |
if: ${{ github.event.client_payload.tag != 'dev' }} | |
uses: actions/checkout@v4 | |
with: | |
ref: stable | |
- name: "Download the new content" | |
run: | | |
cd "docs/schema" | |
mv index.md .index.md || true | |
rm -f ./* || true | |
mv .index.md index.md || true | |
wget "https://github.com/RiverBench/schema/releases/download/${FROM_TAG}/docs.tar.gz" | |
tar -xzvf docs.tar.gz | |
rm docs.tar.gz | |
- name: Commit changes | |
uses: EndBug/add-and-commit@v9 | |
with: | |
message: ${{ format('Automatic update of schema docs ({1})', github.event.client_payload.repo, github.event.client_payload.tag) }} | |
default_author: github_actions | |
add: docs/schema/* | |
pull: '--rebase --autostash' | |
push: true | |
# *** the part about adding redirects *** | |
- name: "Checkout the repository (gh-pages)" | |
if: ${{ github.event.client_payload.tag == 'dev' }} | |
uses: actions/checkout@v4 | |
with: | |
ref: gh-pages | |
path: gh-pages | |
- name: "Update schema PURL redirects" | |
if: ${{ github.event.client_payload.tag == 'dev' }} | |
uses: docker://ghcr.io/riverbench/ci-worker:main | |
with: | |
args: bash -c "for SCHEMA in $(ls -1 ./docs/schema/*.md | grep -v index.md | grep -Po '[^/]*$') ; do ci-worker generate-redirect ./gh-pages schema \"${SCHEMA%.md}\" dev ; done" | |
- name: Commit changes to the gh-pages branch | |
if: ${{ github.event.client_payload.tag == 'dev' }} | |
uses: EndBug/add-and-commit@v9 | |
with: | |
cwd: ./gh-pages | |
message: 'Update redirects for schemas (dev)' | |
default_author: github_actions | |
add: '.' | |
pull: '--rebase --autostash' | |
push: true | |
# *** end of the part about adding redirects *** | |
- name: "Trigger doc compilation" | |
if: ${{ github.event.client_payload.tag == 'dev' }} | |
uses: peter-evans/repository-dispatch@v3 | |
with: | |
token: ${{ secrets.PAT_DOC_REPO_HOOKS }} | |
event-type: compile-docs | |
client-payload: '{ "tag": "dev" }' |