-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (64 loc) · 2.01 KB
/
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: "Docs"
on:
push:
branches:
- '3.5'
pull_request:
branches:
- '3.5'
workflow_dispatch:
jobs:
sync:
name: Sync to Discourse
runs-on: [self-hosted, linux, arm64, aws, large]
env:
TOPIC_IDS: './.github/discourse-topic-ids.yaml'
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true
- name: Build Juju client
run: |
go install -v -tags minimal ./cmd/juju
- name: Generate CLI docs
id: gen
shell: bash
run: |
# Create temp dir to hold docs
DOCS_DIR=$(mktemp -d)
echo "dir=${DOCS_DIR}" >> $GITHUB_OUTPUT
juju documentation --split --out=$DOCS_DIR --discourse-ids $TOPIC_IDS
# TODO: save $DOCS_DIR as an artifact
- name: Generate controller config keys doc
env:
DOCS_DIR: ${{ steps.gen.outputs.dir }}
JUJU_SRC_ROOT: '.'
run: |
go run ./scripts/md-gen/controller-config
- name: Add version notice to generated docs
env:
DOCS_DIR: ${{ steps.gen.outputs.dir }}
run: |
go run ./scripts/md-gen/version-notice
- name: pip install requirements
run: |
python3 -m venv .venv
.venv/bin/python3 -m pip install -r ./scripts/discourse-sync/requirements.txt
- name: Check docs on Discourse
if: github.event_name == 'pull_request'
env:
DOCS_DIR: ${{ steps.gen.outputs.dir }}
run: |
.venv/bin/python3 ./scripts/discourse-sync/main.py check
- name: Sync docs to Discourse
if: github.event_name == 'push'
env:
DISCOURSE_API_USERNAME: ${{ secrets.DISCOURSE_API_USERNAME }}
DISCOURSE_API_KEY: ${{ secrets.DISCOURSE_API_KEY }}
DOCS_DIR: ${{ steps.gen.outputs.dir }}
run: |
.venv/bin/python3 ./scripts/discourse-sync/main.py sync