name: Fabrication document # With a docs/input.md (typecad-docgen front matter, as in PowerModule): # builds the fabrication document of the first board and pushes it to the # docu branch, so main stays free of generated files. Adapted from # LVSolarBuck and PowerModule. on: push: branches: [main] paths: - 'docs/input.md' - 'hardware/**' - '.gitea/workflows/docgen.yml' jobs: docgen: runs-on: kicad10_auto steps: - uses: actions/checkout@v4 - name: Inputs id: inputs run: | pcb=$(find hardware -mindepth 2 -maxdepth 2 -name '*.kicad_pcb' | sort | head -1) if [ -f docs/input.md ] && [ -n "$pcb" ]; then echo "pcb=$pcb" >> "$GITHUB_OUTPUT" else echo "No docs/input.md or no board yet: nothing to build." fi - name: Build if: steps.inputs.outputs.pcb != '' run: | mkdir -p output-docs typecad-docgen docs/input.md "${{ steps.inputs.outputs.pcb }}" -o output-docs/index.html - name: Push to the docu branch if: steps.inputs.outputs.pcb != '' env: GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} run: | git config --global user.email "${{ gitea.actor }}@noreply.localhost" git config --global user.name "${{ gitea.actor }}" REPO_URL=$(git config --get remote.origin.url) AUTHED_URL=${REPO_URL/https:\/\//https:\/\/${GITEA_TOKEN}@} git clone --depth 1 --branch docu "$AUTHED_URL" docu || git clone --depth 1 "$AUTHED_URL" docu cd docu git checkout -B docu git rm -rq . || true cp -r ../output-docs/* . git add -A if git diff --cached --quiet; then echo "No changes"; exit 0; fi git commit -m "chore: fabrication document" git push --force "$AUTHED_URL" docu