add autumn leaves changes. #126
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 and Publish PDF | |
| on: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Build PDF with Docker | |
| run: | | |
| TIMESTAMP=$(date +%Y%m%d-%H%M%S) | |
| PDF_BASE="BarryBook-${TIMESTAMP}" | |
| PDF_NAME="${PDF_BASE}.pdf" | |
| echo "Building PDF: $PDF_NAME" | |
| # lyluatex compiles the LilyPond scores during the LuaLaTeX passes. | |
| make pdf | |
| # Copy the built PDF to the timestamped filename | |
| cp bin/main.pdf "$PDF_NAME" | |
| echo "PDF_NAME=$PDF_NAME" >> $GITHUB_ENV | |
| - name: Clean up build artifacts | |
| run: | | |
| # Remove LilyPond build artifacts but keep the PDF and source files | |
| rm -f *.log *.ly~ *.pdf~ 2>/dev/null || true | |
| # List what we're publishing | |
| echo "Files to publish:" | |
| test -f "${{ env.PDF_NAME }}" | |
| ls -lh "${{ env.PDF_NAME }}" | |
| # Rolling “latest” release: force-move tag so GitHub’s Source code (zip/tar.gz) match this commit; | |
| # we only upload the PDF — no duplicate custom source zip. | |
| - name: Publish latest release (gh + git tag) | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| GH_REPO: ${{ github.repository }} | |
| TARGET: ${{ github.sha }} | |
| PDF_NAME: ${{ env.PDF_NAME }} | |
| run: | | |
| set -euo pipefail | |
| TAG=latest | |
| TITLE='Latest Barry Book PDF' | |
| NOTES="PDF for commit ${TARGET:0:7}. Tracked source: use this release’s **Source code (zip)** (same tag / SHA)." | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git config user.name "github-actions[bot]" | |
| git tag -f "$TAG" "$TARGET" | |
| git push --force origin "refs/tags/$TAG" | |
| # GitHub keeps the original release `published_at` when editing in place, so | |
| # the UI shows "released … ago" from the first create even after new PDFs. | |
| # Delete the release object only (keep the git tag), then recreate so the | |
| # timestamp matches the new build. | |
| gh release delete "$TAG" --yes 2>/dev/null || true | |
| gh release create "$TAG" "$PDF_NAME" \ | |
| --target "$TARGET" \ | |
| --title "$TITLE" \ | |
| --notes "$NOTES" \ | |
| --latest |