-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (61 loc) · 2.27 KB
/
category-doc-update.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: "Update category documentation"
on:
repository_dispatch:
types: [category-doc-update]
jobs:
update_category_docs:
name: "Update category 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: |
CATEGORY_ID="${FROM_REPO#RiverBench/category-}"
VERSION_ID="${FROM_TAG#v}"
# Category
rm -rf "docs/categories/${CATEGORY_ID}" || true
mkdir -p "docs/categories/${CATEGORY_ID}"
cd "docs/categories/${CATEGORY_ID}"
wget "https://github.com/${FROM_REPO}/releases/download/${FROM_TAG}/docs.tar.gz"
tar -xzvf docs.tar.gz
mv ./category/* . || true
rm -r ./category
# Profiles
mkdir -p "../../profiles" || true
rm -f ../../profiles/${CATEGORY_ID}-*.md || true
mv ./profiles/*.md "../../profiles" || true
rm -r ./profiles
# Tasks
mkdir -p "../../tasks" || true
rm -rf ../../tasks/${CATEGORY_ID}-* || true
cp -r ./tasks/* ../../tasks || true
rm -r ./tasks
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/categories docs/profiles docs/tasks'
pull: '--rebase --autostash'
push: true
- 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" }'