-
Notifications
You must be signed in to change notification settings - Fork 29
48 lines (40 loc) · 1.51 KB
/
build_docs.yml
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
name: build docs
on: push
jobs:
build_docs:
runs-on: "ubuntu-20.04"
steps:
- name: Check out repository code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Build docs
run: make docs
- name: Get current git ref
id: rev_parse
run: echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Checkout ooni/docs
uses: actions/checkout@v2
with:
repository: "ooni/docs"
ssh-key: ${{ secrets.OONI_DOCS_DEPLOYKEY }}
path: "ooni-docs"
- name: Update docs
run: cp -R dist/docs/* ooni-docs/src/content/docs/backend/
- name: Check for conflicting slugs
run: |
cat ooni-docs/src/content/docs/backend/*.md \
| grep "^slug:" | awk -F':' '{gsub(/^ +/, "", $2); print $2}' | sort | uniq -c \
| awk '{if ($1 > 1) { print "duplicate slug for: " $2; exit 1}}'
- name: Print the lines of the generated docs
run: wc -l ooni-docs/src/content/docs/backend/*
- name: Commit changes
# Only push the docs update when we are in master
if: github.ref == 'refs/heads/master'
run: |
cd ooni-docs
git config --global user.email "github+backend@ooni.org"
git config --global user.name "OONI Github Actions Bot"
git add .
git commit -m "auto: update backend docs to ${{ steps.rev_parse.outputs.COMMIT_HASH }}" || echo "No changes to commit"
git push origin