Skip to content

Commit ed927bd

Browse files
djelovinaDenis Jelovina
andauthored
6 html support (#7)
* Enhance CI workflow to support HTML compilation and add local testing instructions * Fix reference to online PDF version from README --------- Co-authored-by: Denis Jelovina <[email protected]>
1 parent b984063 commit ed927bd

File tree

3 files changed

+60
-24
lines changed

3 files changed

+60
-24
lines changed

.github/workflows/static.yml

Lines changed: 40 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ name: Deploy static content to Pages
44
on:
55
# Runs on pushes targeting the default branch
66
push:
7-
branches: ["master", "beamer-tutorial-2025"]
7+
branches: ["master", "main", "6-html-support"]
88

99
# Allows you to run this workflow manually from the Actions tab
1010
workflow_dispatch:
@@ -22,39 +22,45 @@ concurrency:
2222
cancel-in-progress: false
2323

2424
jobs:
25-
build_pdf: # Job for LaTeX and Beamer PDF compilation
25+
build_assets: # Job for PDF and HTML compilation
2626
runs-on: ubuntu-latest
2727
steps:
2828
- name: Checkout repository
2929
uses: actions/checkout@v4
3030

31-
- name: Compile LaTeX (main.tex)
32-
uses: xu-cheng/latex-action@v3
33-
with:
34-
root_file: main.tex
31+
- name: Compile main.tex to PDF
32+
run: |
33+
docker run --rm --user $(id -u):$(id -g) \
34+
-v "${{ github.workspace }}":/workdir \
35+
-w /workdir \
36+
ghcr.io/xu-cheng/texlive-full:latest \
37+
sh -c "latexmk -C main.tex && latexmk -pdf -interaction=nonstopmode -halt-on-error -file-line-error main.tex"
3538
36-
- name: Compile Beamer tutorial (beamer-tutorial.tex)
37-
uses: xu-cheng/latex-action@v3
38-
with:
39-
root_file: beamer-tutorial.tex
39+
- name: Compile main.tex to HTML
40+
run: |
41+
docker run --rm --user $(id -u):$(id -g) \
42+
-v "${{ github.workspace }}":/workdir \
43+
-w /workdir \
44+
ghcr.io/xu-cheng/texlive-full:latest \
45+
sh -c "rm -rf main-html && make4ht main.tex 'xhtml,css-in' -d main-html"
4046
41-
- name: Upload main PDF artifact
47+
- name: Upload PDF artifact
4248
uses: actions/upload-artifact@v4
4349
with:
44-
name: latex-pdf-output
50+
name: pdf-output
4551
path: main.pdf
4652

47-
- name: Upload beamer PDF artifact
53+
- name: Upload HTML artifact
4854
uses: actions/upload-artifact@v4
4955
with:
50-
name: beamer-pdf-output
51-
path: beamer-tutorial.pdf
56+
name: html-output
57+
path: main-html/
5258

5359
# Single deploy job since we're just deploying
5460
deploy:
55-
# Only deploy from the protected default branch
56-
if: github.ref == 'refs/heads/master'
57-
needs: [build_pdf]
61+
# Only deploy from the protected default branch (support common names)
62+
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'
63+
needs: [build_assets]
5864
environment:
5965
name: github-pages
6066
url: ${{ steps.deployment.outputs.page_url }}
@@ -66,25 +72,36 @@ jobs:
6672
steps:
6773
- name: Download all artifacts
6874
uses: actions/download-artifact@v4
75+
if: ${{ !env.ACT }}
6976
with:
70-
path: artifacts/ # Downloads both latex-pdf-output and beamer-pdf-output
77+
path: artifacts/
7178

7279
- name: Prepare public directory for Pages
80+
if: ${{ !env.ACT }}
7381
run: |
7482
mkdir public
75-
# Move PDFs to public/
76-
mv artifacts/latex-pdf-output/main.pdf public/
77-
mv artifacts/beamer-pdf-output/beamer-tutorial.pdf public/
78-
ls -l public
83+
# Move assets to public/
84+
mv artifacts/pdf-output/main.pdf public/
85+
mv artifacts/html-output public/main-html
86+
# Create a simple index page
87+
echo '<html><head><title>ALP Tutorial Artifacts</title></head><body>' > public/index.html
88+
echo '<h1>ALP Tutorial Artifacts</h1><ul>' >> public/index.html
89+
echo '<li><a href="main.pdf">Main PDF</a></li>' >> public/index.html
90+
echo '<li><a href="main-html/main.html">Main HTML</a></li>' >> public/index.html
91+
echo '</ul></body></html>' >> public/index.html
92+
ls -lR public
7993
8094
- name: Setup Pages
95+
if: ${{ !env.ACT }}
8196
uses: actions/configure-pages@v5
8297

8398
- name: Upload Pages artifact
99+
if: ${{ !env.ACT }}
84100
uses: actions/upload-pages-artifact@v3
85101
with:
86102
path: ./public
87103

88104
- name: Deploy to GitHub Pages
105+
if: ${{ !env.ACT }}
89106
id: deployment
90107
uses: actions/deploy-pages@v4

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,16 @@ check-deps:
6969
if ! kpsewhich beamer.cls >/dev/null 2>&1; then echo "Missing: Beamer class (install latex-beamer or texlive-latex-recommended)"; ok=0; fi; \
7070
if [ $$ok -eq 1 ]; then echo "Dependency check: OK"; else echo "See 'make deps' for install hints."; fi
7171

72+
# --- local CI testing -------------------------------------------------------
73+
.PHONY: test-ci
74+
test-ci:
75+
@if ! command -v act >/dev/null 2>&1; then \
76+
echo "Error: 'act' is not installed. Please see README.md for installation instructions."; \
77+
exit 1; \
78+
fi
79+
@echo "==> Running local CI test with 'act'..."
80+
act push -P ubuntu-latest=catthehacker/ubuntu:act-latest --container-architecture linux/amd64
81+
7282
# --- beamer target ----------------------------------------------------------
7383
BEAMER_MAIN := beamer-tutorial
7484
BEAMER_SRC := $(BEAMER_MAIN).tex

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,19 @@
22

33
# ALP-Tutorial
44

5-
The [pdf](https://algebraic-programming.github.io/ALP-Tutorial/main.pdf) version is available online.
65

76
## License
87

98
This project is licensed under the [Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License](LICENSE).
109

1110

11+
## Published Site
12+
13+
The built HTML and PDF are published to GitHub Pages automatically when the workflow runs on the `master` branch.
14+
15+
- **Site root:** https://algebraic-programming.github.io/ALP-Tutorial/
16+
- **PDF (direct):** https://algebraic-programming.github.io/ALP-Tutorial/main.pdf
17+
- **HTML (direct):** https://algebraic-programming.github.io/ALP-Tutorial/main-html/main.html
18+
19+
20+

0 commit comments

Comments
 (0)