Merge pull request #18073 from manadart/3.5-uniter-peer-rels-last #57
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: "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@v4 | |
- 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: Generate hook tool docs | |
env: | |
DOCS_DIR: ${{ steps.gen.outputs.dir }} | |
run: | | |
go run ./scripts/md-gen/hook-tools | |
- 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 |