@@ -2,8 +2,7 @@ name: Build PDF
22
33on :
44 push :
5- tags :
6- - " v*"
5+ branches : [main]
76
87permissions :
98 contents : write
1615 - name : Checkout source
1716 uses : actions/checkout@v4
1817 with :
19- ref : ${{ github.ref }}
2018 fetch-depth : 0
2119
2220 - name : Set up Python
@@ -35,18 +33,18 @@ jobs:
3533 - name : Convert Inter fonts (OTF to TTF for ReportLab)
3634 run : python scripts/convert_fonts.py
3735
38- - name : Get tag name
36+ - name : Get short commit hash
3937 id : vars
40- run : echo "tag=${GITHUB_REF#refs/tags/} " >> "$GITHUB_OUTPUT"
38+ run : echo "short_sha=$(git rev-parse --short=6 HEAD) " >> "$GITHUB_OUTPUT"
4139
4240 - name : Build both PDFs
43- run : python scripts/build_pdf.py "gitbyexample-${{ steps.vars.outputs.tag }}" --both
41+ run : python scripts/build_pdf.py "gitbyexample-${{ steps.vars.outputs.short_sha }}" --both
4442
4543 - name : Publish to pdf branch
4644 run : |
47- TAG ="${{ steps.vars.outputs.tag }}"
48- LIGHT="gitbyexample-${TAG }-light.pdf"
49- DARK="gitbyexample-${TAG }-dark.pdf"
45+ SHORT ="${{ steps.vars.outputs.short_sha }}"
46+ LIGHT="gitbyexample-${SHORT }-light.pdf"
47+ DARK="gitbyexample-${SHORT }-dark.pdf"
5048
5149 cp "$LIGHT" /tmp/
5250 cp "$DARK" /tmp/
@@ -74,13 +72,13 @@ jobs:
7472 "" \
7573 "This branch contains auto-generated PDF builds of the book." \
7674 "" \
77- "Each tag produces two PDFs:" \
78- "- gitbyexample-TAG -light.pdf" \
79- "- gitbyexample-TAG -dark.pdf" \
75+ "Each push to main produces two PDFs:" \
76+ "- gitbyexample-COMMIT -light.pdf" \
77+ "- gitbyexample-COMMIT -dark.pdf" \
8078 "" \
8179 "Download the latest: check the most recent file below." \
8280 > README.md
8381
8482 git add README.md gitbyexample-*.pdf
85- git commit -m "pdf: build from ${TAG }" || echo "No changes to commit"
83+ git commit -m "pdf: build from ${GITHUB_SHA::6 }" || echo "No changes to commit"
8684 git push origin pdf
0 commit comments