main-doc-update #104
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 main documentation" | |
on: | |
repository_dispatch: | |
types: [main-doc-update] | |
jobs: | |
update_main_docs: | |
name: "Update main documentation" | |
# Only one job at a time, to avoid confflicts. | |
concurrency: doc-update | |
runs-on: "ubuntu-latest" | |
permissions: write-all | |
env: | |
FROM_TAG: ${{ github.event.client_payload.tag }} | |
steps: | |
- name: "Checkout the repository" | |
uses: actions/checkout@v3 | |
with: | |
ref: main | |
- name: "Download the new content for profiles" | |
run: | | |
VERSION_ID="${FROM_TAG#v}" | |
mkdir -p "docs/profiles/temp" | |
cd "docs/profiles/temp" | |
wget "https://github.com/RiverBench/RiverBench/releases/download/${FROM_TAG}/profiles_docs.tar.gz" | |
tar -xzvf profiles_docs.tar.gz | |
rm profiles_docs.tar.gz | |
mv table.md ../ || true | |
for name in $(ls -1 *.md); do | |
mkdir -p "../${name%.md}" | |
mv "${name}" "../${name%.md}/${VERSION_ID}.md" | |
done | |
cd ../ | |
rm -rf ./temp | |
- name: "Download the new content for the main documentation" | |
run: | | |
VERSION_ID="${FROM_TAG#v}" | |
cd "docs" | |
if [ "${VERSION_ID}" == "dev" ] ; then | |
rm "index.md" || true | |
wget "https://github.com/RiverBench/RiverBench/releases/download/dev/index.md" | |
cd datasets | |
rm "table.md" || true | |
wget -O "table.md" "https://github.com/RiverBench/RiverBench/releases/download/dev/dataset_table.md" | |
else | |
mkdir -p "v" | |
rm -rf "./v/${VERSION_ID}" || true | |
mkdir "./v/${VERSION_ID}" | |
cd "./v/${VERSION_ID}" | |
mkdir -p "documentation" | |
wget "https://github.com/RiverBench/RiverBench/releases/download/${FROM_TAG}/index.md" | |
cd ../../../ | |
fi | |
- name: Copy docs for a tagged release | |
if: startsWith(github.event.client_payload.tag, 'v') | |
uses: docker://ghcr.io/riverbench/ci-worker:main | |
with: | |
args: sh -c "ci-worker tag-docs docs/documentation \"docs/v/${FROM_TAG#v}/documentation\"" | |
- name: Commit changes | |
uses: EndBug/add-and-commit@v9 | |
with: | |
message: ${{ format('Automatic docs update ({0})', github.event.client_payload.tag) }} | |
default_author: github_actions | |
add: docs/* | |
pull: '--rebase --autostash' | |
push: true | |
- name: "Trigger doc compilation" | |
uses: peter-evans/repository-dispatch@v2 | |
with: | |
token: ${{ secrets.PAT_DOC_REPO_HOOKS }} | |
event-type: compile-docs |