Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
592b7259aThis file is pinned to the selected release. Download the original to open it in your design tool.
name: Docs
on:
push:
branches: [ '*' ]
pull_request:
branches: [ master ]
workflow_dispatch:
permissions:
contents: read
actions: read
pages: write
id-token: write
jobs:
markdownlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Install markdownlint
run: npm install -g markdownlint-cli2
- name: Run markdownlint
run: markdownlint-cli2 "**/*.md"
build_book:
runs-on: ubuntu-latest
needs: markdownlint
env:
FULL: ${{ github.event_name == 'push' && (github.ref_name == 'master' || github.ref_name == 'dev') && github.repository == 'okalachev/flix' }}
QUADCOPTER_DEV_TOKEN: ${{ secrets.QUADCOPTER_DEV_TOKEN }}
steps:
- uses: actions/checkout@v7
- name: Install mdBook
run: cargo install mdbook --vers 0.4.43 --locked
- name: Download additional files
if: ${{ env.QUADCOPTER_DEV_TOKEN && env.FULL }}
uses: actions/checkout@v7
with:
repository: okalachev/quadcopter.dev
ref: content
token: ${{ secrets.QUADCOPTER_DEV_TOKEN }}
path: quadcopter.dev
fetch-depth: 1
- name: Add additional files
if: ${{ env.QUADCOPTER_DEV_TOKEN && env.FULL }}
run: rsync -a --keep-dirlinks quadcopter.dev/. docs/book/
- name: Build book
run: cd docs && mdbook build
- name: Wait for Build to complete
if: ${{ env.FULL }}
uses: matiasalbarello/wait-on-check-action-ts@v1.2.0
with:
ref: ${{ github.sha }}
check-name: build_linux
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 30
- name: Find firmware binaries
if: ${{ env.FULL }}
id: build_run
run: |
RUN_ID=$(gh api "repos/${{ github.repository }}/actions/workflows/build.yml/runs?head_sha=${{ github.sha }}" --jq '.workflow_runs[0].id')
echo "id=$RUN_ID" >> $GITHUB_OUTPUT
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Download firmware binaries
if: ${{ env.FULL }}
uses: actions/download-artifact@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
run-id: ${{ steps.build_run.outputs.id }}
name: firmware-binary
path: docs/build
- name: Create shortcuts for firmware binaries
if: ${{ env.FULL }}
working-directory: docs/build
run: |
for FQBN in esp32.esp32.*; do
zip -r $FQBN.zip $FQBN
BOARD="${FQBN#esp32.esp32.}"
ln -s "$FQBN/flix.ino.merged.bin" "flix.$BOARD.merged.bin"
ln -s "$FQBN/flix.ino.bin" "flix.$BOARD.bin"
ln -s "$FQBN/flix.ino.bootloader.bin" "flix.$BOARD.bootloader.bin"
done
- name: Put version file
run: echo "${{ github.sha }}" > docs/build/version.txt
- name: Test build artifacts
working-directory: docs/build
run: |
tree -a -I .git
ls index.html gyro.html geometry.html firmware.html flix.esp32.merged.bin flix.esp32c3.merged.bin \
flix.esp32s3.merged.bin flix.esp32s3.opi.merged.bin flix.esp32s3.qspi.merged.bin flix.flix2.merged.bin \
meta/general.json meta/parameters.json version.txt
- name: Upload artifact
uses: actions/upload-pages-artifact@v5
with:
path: docs/build
deploy:
if: ${{ github.event_name == 'push' && github.ref_name == 'master' }}
concurrency:
group: "pages"
cancel-in-progress: true
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build_book
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5