dataset-doc-update #269
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 dataset documentation" | |
on: | |
repository_dispatch: | |
types: [dataset-doc-update] | |
jobs: | |
update_dataset_docs: | |
name: "Update dataset documentation" | |
runs-on: "ubuntu-latest" | |
permissions: write-all | |
env: | |
FROM_REPO: ${{ github.event.client_payload.repo }} | |
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: | | |
DATASET_ID="${FROM_REPO#RiverBench/dataset-}" | |
rm -rf "docs/datasets/${DATASET_ID}" || true | |
mkdir -p "docs/datasets/${DATASET_ID}" | |
cd "docs/datasets/${DATASET_ID}" | |
wget "https://github.com/${FROM_REPO}/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 {0} ({1})', github.event.client_payload.repo, github.event.client_payload.tag) }} | |
default_author: github_actions | |
add: docs/datasets/* | |
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 dataset PURL redirects" | |
if: ${{ github.event.client_payload.tag == 'dev' }} | |
uses: docker://ghcr.io/riverbench/ci-worker:main | |
with: | |
args: sh -c "ci-worker generate-redirect ./gh-pages datasets \"${FROM_REPO#RiverBench/dataset-}\" dev" | |
- 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: ${{ format('Update redirect for {0} ({1})', github.event.client_payload.repo, github.event.client_payload.tag) }} | |
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" }' |