Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 0 additions & 2 deletions .gitbook/README.md

This file was deleted.

Binary file not shown.
Binary file removed .gitbook/assets/CompanionSpecialFunctions (1).png
Binary file not shown.
53 changes: 0 additions & 53 deletions .gitbook/assets/README.md

This file was deleted.

Binary file removed .gitbook/assets/RadioSpecialFunctions (1) (1).png
Binary file not shown.
Binary file removed .gitbook/assets/RadioSpecialFunctions (1).png
Binary file not shown.
Binary file removed .gitbook/assets/btn_donate_LG (1).gif
Binary file not shown.
Binary file removed .gitbook/assets/btn_donate_LG.gif
Binary file not shown.
Binary file not shown.
Binary file removed .gitbook/assets/clear-example1 (1) (1) (1) (1).png
Binary file not shown.
Binary file removed .gitbook/assets/clear-example2 (1) (1) (1) (1).png
Binary file not shown.
Binary file removed .gitbook/assets/clear-example2 (1) (1) (1).png
Binary file not shown.
Binary file removed .gitbook/assets/companion-settings (1).png
Binary file not shown.
Binary file removed .gitbook/assets/companion-settings.png
Binary file not shown.
Binary file removed .gitbook/assets/count-dn (1) (1).png
Binary file not shown.
Binary file removed .gitbook/assets/count-dn (1).png
Binary file not shown.
Binary file removed .gitbook/assets/count-up (1) (1).png
Binary file not shown.
Binary file removed .gitbook/assets/count-up (1).png
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .gitbook/assets/drawCombobox-example (1).png
Binary file not shown.
Binary file removed .gitbook/assets/drawCombobox-example.png
Binary file not shown.
Binary file removed .gitbook/assets/drawFilledRectangle-example (1).png
Binary file not shown.
Binary file removed .gitbook/assets/drawFilledRectangle-example.png
Binary file not shown.
Binary file removed .gitbook/assets/drawGauge-example (1).png
Binary file not shown.
Binary file removed .gitbook/assets/drawGauge-example.png
Binary file not shown.
Binary file removed .gitbook/assets/drawLine-example (1).png
Binary file not shown.
Binary file removed .gitbook/assets/drawLine-example.png
Diff not rendered.
Binary file removed .gitbook/assets/drawNumber-example (1) (1).png
Diff not rendered.
Binary file removed .gitbook/assets/drawNumber-example (1).png
Diff not rendered.
Binary file removed .gitbook/assets/drawPixmap-example (1).png
Diff not rendered.
Binary file removed .gitbook/assets/drawPixmap-example.png
Diff not rendered.
Binary file removed .gitbook/assets/drawPoint-example (1).png
Diff not rendered.
Binary file removed .gitbook/assets/drawPoint-example.png
Diff not rendered.
Binary file removed .gitbook/assets/drawRectangle-example (1).png
Diff not rendered.
Binary file removed .gitbook/assets/drawRectangle-example.png
Diff not rendered.
Binary file removed .gitbook/assets/drawScreenTitle-example (1) (1).png
Diff not rendered.
Binary file removed .gitbook/assets/drawScreenTitle-example (1).png
Diff not rendered.
Binary file removed .gitbook/assets/drawSource-example (1).png
Diff not rendered.
Binary file removed .gitbook/assets/drawSource-example.png
Diff not rendered.
Binary file removed .gitbook/assets/drawSwitch-example (1).png
Diff not rendered.
Binary file removed .gitbook/assets/drawSwitch-example.png
Diff not rendered.
Binary file removed .gitbook/assets/drawText-example (1).png
Diff not rendered.
Binary file removed .gitbook/assets/drawText-example.png
Diff not rendered.
Binary file removed .gitbook/assets/drawTimer-example (1) (1).png
Diff not rendered.
Binary file removed .gitbook/assets/drawTimer-example (1).png
Diff not rendered.
Binary file removed .gitbook/assets/flags (1).png
Diff not rendered.
Binary file removed .gitbook/assets/flags.png
Diff not rendered.
Binary file removed .gitbook/assets/getDateTime-example (1) (1).png
Diff not rendered.
Binary file removed .gitbook/assets/getDateTime-example (1).png
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file removed .gitbook/assets/getGeneralSettings-example (1).png
Diff not rendered.
Binary file removed .gitbook/assets/getValue-example (1) (1) (1).png
Diff not rendered.
Binary file removed .gitbook/assets/getValue-example (1) (1).png
Diff not rendered.
Binary file removed .gitbook/assets/setGlobalVariable-example (1).png
Diff not rendered.
Binary file removed .gitbook/assets/setGlobalVariable-example.png
Diff not rendered.
Binary file removed .gitbook/assets/shocount (1).png
Diff not rendered.
Binary file removed .gitbook/assets/shocount.png
Diff not rendered.
121 changes: 121 additions & 0 deletions .github/workflows/preview-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# Builds a preview of the docs for each pull request and uploads it to
# Cloudflare as a Worker *version* with a preview alias. Production keeps
# serving the deployed version; the preview is only reachable at
# https://pr-<number>-edgetx-lua-reference-guide.edgetx.workers.dev/
#
# The PR is built as the version its base branch publishes (main -> "dev",
# edgetx_<x.y> -> "<x.y>", plus "latest" for the latest release branch) on
# top of the current gh-pages tree, so the preview is the whole site with
# that one version replaced. Nothing is pushed to gh-pages.
#
# Only runs for PRs from branches in this repo: fork PRs don't get the
# Cloudflare secrets, and building untrusted code with them available
# would be unsafe anyway.
name: Preview Docs

on:
pull_request:
branches:
- main
- "edgetx_*"

permissions:
contents: read
pull-requests: write

concurrency:
group: preview-docs-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
preview:
if: github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest

steps:
- name: Check out source
uses: actions/checkout@v7
with:
fetch-depth: 0

- name: Resolve version metadata
id: version
shell: bash
env:
LATEST_BRANCH: ${{ vars.DOCS_LATEST_BRANCH || 'edgetx_2.12' }}
run: |
case "${GITHUB_BASE_REF}" in
main)
version_id="dev"
title="Dev"
;;
edgetx_[0-9]*.[0-9]*)
version_id="${GITHUB_BASE_REF#edgetx_}"
title="${version_id}"
;;
*)
echo "Unsupported base branch: ${GITHUB_BASE_REF}" >&2
exit 1
;;
esac

if [[ "${GITHUB_BASE_REF}" == "${LATEST_BRANCH}" ]]; then
aliases="${version_id} latest"
else
aliases="${version_id}"
fi

{
echo "version_id=${version_id}"
echo "title=${title}"
echo "aliases=${aliases}"
echo "alias=pr-${{ github.event.pull_request.number }}"
} >> "${GITHUB_OUTPUT}"

- name: Install uv
uses: astral-sh/setup-uv@v10.3.2

- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: "3.11"

- name: Sync docs dependencies
run: uv sync

- name: Configure git author
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"

- name: Build preview into local gh-pages
env:
DOCS_EDIT_URI: edit/${{ github.head_ref }}/website/md-docs/
run: |
git branch -f gh-pages origin/gh-pages
uv run mike deploy --update-aliases --title "${{ steps.version.outputs.title }}" ${{ steps.version.outputs.aliases }}

- name: Export gh-pages tree for Cloudflare
run: |
rm -rf .site-publish
mkdir .site-publish
git archive gh-pages | tar -x -C .site-publish

- name: Upload preview version to Cloudflare Workers
uses: cloudflare/wrangler-action@v4
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: versions upload --preview-alias ${{ steps.version.outputs.alias }} --message "PR #${{ github.event.pull_request.number }} @ ${{ github.event.pull_request.head.sha }}"

- name: Comment preview link on the PR
env:
GH_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ github.event.pull_request.number }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
url="https://${{ steps.version.outputs.alias }}-edgetx-lua-reference-guide.edgetx.workers.dev/${{ steps.version.outputs.version_id }}/"
body="📖 **Docs preview:** ${url}

Built from ${HEAD_SHA::7} as the \`${{ steps.version.outputs.version_id }}\` version, on top of the currently published site."
gh pr comment "${PR_NUMBER}" --edit-last --create-if-none --body "${body}"
148 changes: 148 additions & 0 deletions .github/workflows/publish-versioned-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
# Publishes each docs branch via `mike deploy` on every push:
# main -> "dev"
# edgetx_<x.y> -> "<x.y>", plus "latest" for the latest release branch
#
# Every branch carries its own MkDocs site (mkdocs.yml + website/md-docs/)
# and an identical copy of this workflow, so a push builds the branch it
# came from. The latest release branch comes from the DOCS_LATEST_BRANCH
# repository variable (falling back to edgetx_2.12), so moving "latest" to
# a new release is a settings change rather than an edit on every branch.
#
# mike keeps the accumulated versioned site on the gh-pages branch; after
# each deploy, the full gh-pages tree is published to Cloudflare Workers
# (static assets, see wrangler.jsonc). Requires the CLOUDFLARE_API_TOKEN and
# CLOUDFLARE_ACCOUNT_ID repository secrets.
name: Publish Versioned Docs

on:
push:
branches:
- main
- "edgetx_*"
workflow_dispatch:

permissions:
contents: write

jobs:
publish:
runs-on: ubuntu-latest

# One group per branch. GitHub keeps at most one pending run per group
# and cancels older pending ones, which is harmless here: the newest
# push to a branch already contains the older ones. Different branches
# publish in parallel and retry if another one updates gh-pages first.
concurrency:
group: publish-versioned-docs-${{ github.ref_name }}
cancel-in-progress: false

steps:
- name: Check out source
uses: actions/checkout@v7
with:
fetch-depth: 0

- name: Install uv
uses: astral-sh/setup-uv@v10.3.2

- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: "3.11"

- name: Resolve version metadata
id: version
shell: bash
env:
LATEST_BRANCH: ${{ vars.DOCS_LATEST_BRANCH || 'edgetx_2.12' }}
run: |
branch="${GITHUB_REF_NAME}"

case "${branch}" in
main)
version_id="dev"
title="Dev"
;;
edgetx_[0-9]*.[0-9]*)
version_id="${branch#edgetx_}"
title="${version_id}"
;;
*)
echo "Unsupported branch: ${branch}" >&2
exit 1
;;
esac

if [[ "${branch}" == "${LATEST_BRANCH}" ]]; then
aliases="${version_id} latest"
is_latest="true"
else
aliases="${version_id}"
is_latest="false"
fi

{
echo "version_id=${version_id}"
echo "title=${title}"
echo "aliases=${aliases}"
echo "is_latest=${is_latest}"
} >> "${GITHUB_OUTPUT}"

- name: Sync docs dependencies
run: uv sync

- name: Configure git author
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"

- name: Publish docs with mike
env:
# "Edit this page" should open the branch this version is built from.
DOCS_EDIT_URI: edit/${{ github.ref_name }}/website/md-docs/
IS_LATEST: ${{ steps.version.outputs.is_latest }}
run: |
# Other branches may push to gh-pages while this one builds. mike's
# push is then rejected as non-fast-forward, so rebuild on top of
# the new tip and try again.
for attempt in 1 2 3 4 5; do
git fetch origin gh-pages
git branch -f gh-pages origin/gh-pages
if uv run mike deploy --push --update-aliases --title "${{ steps.version.outputs.title }}" ${{ steps.version.outputs.aliases }} \
&& { [[ "${IS_LATEST}" != "true" ]] || uv run mike set-default --push latest; }; then
exit 0
fi
echo "gh-pages push failed (attempt ${attempt}), retrying" >&2
sleep $((attempt * 10))
done
exit 1

deploy:
needs: publish
runs-on: ubuntu-latest

# One group across all branches, so uploads never overlap. If several
# are queued, GitHub keeps only the newest; that's fine because it
# exports gh-pages when it starts, which already includes every
# earlier publish. The last upload is therefore always the newest tree.
concurrency:
group: publish-versioned-docs-cloudflare
cancel-in-progress: false

steps:
- name: Check out source
uses: actions/checkout@v7

- name: Export gh-pages tree for Cloudflare
run: |
git fetch --depth 1 origin gh-pages
rm -rf .site-publish
mkdir .site-publish
git archive FETCH_HEAD | tar -x -C .site-publish

- name: Deploy to Cloudflare Workers
uses: cloudflare/wrangler-action@v4
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: deploy
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/_book/
/node_modules/
/book.pdf
/site/
/.site-legacy-generated/
/site-legacy/
.tmp/
.venv/
__pycache__/
/.site-publish/
Loading
Loading