feat: production-ready v1.4.0 — real source code, real tests, CI pipe… #25
Workflow file for this run
This file contains hidden or 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: Build & Release Book PDF | |
| on: | |
| push: | |
| branches: [master, main] | |
| paths: | |
| - 'docs/book/**' | |
| tags: | |
| - 'v*' | |
| pull_request: | |
| paths: | |
| - 'docs/book/**' | |
| release: | |
| types: [published, created] | |
| workflow_dispatch: | |
| concurrency: | |
| group: book-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: write | |
| env: | |
| PANDOC_VERSION: "3.1.11" | |
| jobs: | |
| validate: | |
| name: Validate Book Source | |
| runs-on: ubuntu-latest | |
| outputs: | |
| lines: ${{ steps.check.outputs.lines }} | |
| has_book: ${{ steps.check.outputs.has_book }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Check book source | |
| id: check | |
| run: | | |
| if [ ! -f docs/book/book.md ]; then | |
| echo "has_book=false" >> $GITHUB_OUTPUT | |
| echo "lines=0" >> $GITHUB_OUTPUT | |
| echo "WARNING: docs/book/book.md not found — skipping PDF build" | |
| exit 0 | |
| fi | |
| echo "has_book=true" >> $GITHUB_OUTPUT | |
| LINES=$(wc -l < docs/book/book.md) | |
| echo "lines=$LINES" >> $GITHUB_OUTPUT | |
| echo "Book source: $LINES lines" | |
| build-pdf: | |
| name: Build PDF | |
| runs-on: ubuntu-latest | |
| needs: validate | |
| if: needs.validate.outputs.has_book == 'true' | |
| outputs: | |
| pdf_name: ${{ steps.meta.outputs.pdf_name }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install pandoc & LaTeX | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y pandoc texlive-xetex texlive-fonts-recommended texlive-fonts-extra | |
| - name: Extract metadata | |
| id: meta | |
| run: | | |
| REPO_NAME="${GITHUB_REPOSITORY#*/}" | |
| echo "pdf_name=${REPO_NAME}-guide.pdf" >> $GITHUB_OUTPUT | |
| if [[ "$GITHUB_REF" == refs/tags/* ]]; then | |
| VERSION="${GITHUB_REF#refs/tags/}" | |
| else | |
| VERSION="dev-$(echo $GITHUB_SHA | cut -c1-7)" | |
| fi | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Generate PDF | |
| run: | | |
| pandoc \ | |
| docs/book/book.md \ | |
| -o "docs/book/${{ steps.meta.outputs.pdf_name }}" \ | |
| --pdf-engine=xelatex \ | |
| --from=markdown+smart \ | |
| -V geometry:margin=1in \ | |
| -V fontsize=11pt \ | |
| -V documentclass=report \ | |
| -V "title=eosllm — Official Reference Guide" \ | |
| -V "subtitle=Version ${{ steps.meta.outputs.version }}" \ | |
| -V "author=Srikanth Patchava \\& EmbeddedOS Contributors" \ | |
| -V "date=$(date +'%B %Y')" \ | |
| -V toc=true \ | |
| -V toc-depth=3 \ | |
| -V colorlinks=true \ | |
| --highlight-style=tango \ | |
| --number-sections | |
| - name: Upload PDF | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ steps.meta.outputs.pdf_name }} | |
| path: docs/book/${{ steps.meta.outputs.pdf_name }} | |
| retention-days: 90 | |
| attach-to-release: | |
| name: Attach PDF to Release | |
| runs-on: ubuntu-latest | |
| needs: [validate, build-pdf] | |
| if: github.event_name == 'release' || startsWith(github.ref, 'refs/tags/') | |
| steps: | |
| - name: Download PDF | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ${{ needs.build-pdf.outputs.pdf_name }} | |
| path: ./pdf-output | |
| - name: Determine release tag | |
| id: tag | |
| run: | | |
| if [ "${{ github.event_name }}" = "release" ]; then | |
| echo "tag=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT | |
| else | |
| echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Attach to release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: ./pdf-output/${{ needs.build-pdf.outputs.pdf_name }} | |
| tag_name: ${{ steps.tag.outputs.tag }} | |
| fail_on_unmatched_files: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |