Skip to content

Commit

Permalink
Improved docs from XML generation_toolchain (#2103)
Browse files Browse the repository at this point in the history
* Improved docs from XML generation_toolchain

- Make replaced-by a link
- Fix message field desc
- Make enums in param values into links
- Fixes following testing
- Add deprecated desc, if exists
- Add todo if we ever get WIP tags with text in them
- Make the main lists to dicts, to allow easier merging
- Merge XMLs
- Fix up ordering of items
- Make more robust - can spot new fields
- Improve table layout
- Add max, min, invalid, instance, default, to fields
- Add highlighting for WIP/Deprecated
- Minor fix to intros
- Add placeholder for building dialect tree
- Add summary of stuff in THIS file
- Flake8 Lint
- Workflow to deploy docs + dependencies file

* Update workflow to commit PR
  • Loading branch information
hamishwillee committed May 16, 2024
1 parent 23eb98c commit 2b87f2e
Show file tree
Hide file tree
Showing 3 changed files with 1,251 additions and 0 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/docs_build_and_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Build markdown from XML and deploy

on:
push:
branches: [ "master" ]
pull_request:
branches:
- '*'
workflow_dispatch: # Allows manual triggering

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f doc/requirements.txt ]; then pip install -r doc/requirements.txt; fi
- name: Generate markdown from XML
run: |
cd doc
python3 mavlink_xml_to_markdown.py
- name: Upload docs artifact
uses: actions/upload-artifact@v4
with:
name: xml_file_markdown_docs
path: doc/messages/
retention-days: 1

deploy:
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.merged) }}
needs: build
runs-on: ubuntu-latest

steps:
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: xml_file_markdown_docs
path: ~/_messages

# TBD - copy https://github.com/PX4/PX4-user_guide/blob/main/.github/workflows/docs_deploy.yml
- name: Deploy
run: |
git clone --single-branch --branch master https://${{ secrets.PX4BUILTBOT_PERSONAL_ACCESS_TOKEN }}@github.com/mavlink/mavlink-devguide.git
rm -rf mavlink-devguide/en/messages
mkdir -p mavlink-devguide/en/messages
cp -r ~/_messages/* mavlink-devguide/en/messages/
cd mavlink-devguide
git config --global user.name "${{ secrets.PX4BUILDBOT_USER }}"
git config --global user.email "${{ secrets.PX4BUILDBOT_EMAIL }}"
git add en/messages/*
git commit -a -m "MAVLink messages update `date`"
git push origin master
Loading

0 comments on commit 2b87f2e

Please sign in to comment.