Skip to content

Commit 5006d47

Browse files
committed
Add new CI setup to build makefiles when respective docs change
1 parent f32c33b commit 5006d47

6 files changed

Lines changed: 154 additions & 29 deletions

File tree

.github/workflows/ci.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: LaTeX CI
2+
3+
on:
4+
pull_request:
5+
branches: [ master ]
6+
push:
7+
branches: [ master ]
8+
9+
jobs:
10+
changes:
11+
runs-on: ubuntu-latest
12+
13+
outputs:
14+
matrix: ${{ steps.matrix.outputs.matrix }}
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- id: matrix
22+
shell: bash
23+
run: |
24+
DOCS=("bylaws" "policies" "board-procedures")
25+
26+
if [ "${{ github.event_name }}" = "pull_request" ]; then
27+
BASE_SHA="${{ github.event.pull_request.base.sha }}"
28+
else
29+
BASE_SHA="${{ github.event.before }}"
30+
fi
31+
32+
CHANGED=$(git diff --name-only "$BASE_SHA" "${{ github.sha }}")
33+
34+
SHARED_CHANGED=false
35+
for file in logo.png mathsoc.cls mathsoc.sty title.tex; do
36+
if echo "$CHANGED" | grep -q "^${file}$"; then
37+
SHARED_CHANGED=true
38+
break
39+
fi
40+
done
41+
42+
if [ "$SHARED_CHANGED" = true ]; then
43+
MATRIX='{"directory":["bylaws","policies","board-procedures"]}'
44+
else
45+
DIRS=()
46+
47+
for dir in "${DOCS[@]}"; do
48+
if echo "$CHANGED" | grep -q "^${dir}/"; then
49+
DIRS+=("\"${dir}\"")
50+
fi
51+
done
52+
53+
MATRIX="{\"directory\":[$(IFS=,; echo "${DIRS[*]}")]}"
54+
fi
55+
56+
echo "matrix=$MATRIX" >> "$GITHUB_OUTPUT"
57+
58+
build:
59+
needs: changes
60+
61+
if: ${{ fromJson(needs.changes.outputs.matrix).directory[0] != null }}
62+
63+
runs-on: ubuntu-latest
64+
65+
strategy:
66+
fail-fast: false
67+
matrix: ${{ fromJson(needs.changes.outputs.matrix) }}
68+
69+
container:
70+
image: ghcr.io/xu-cheng/texlive-full:latest
71+
72+
steps:
73+
- uses: actions/checkout@v4
74+
75+
- name: Build ${{ matrix.directory }}
76+
run: |
77+
make -C "${{ matrix.directory }}" public
78+
79+
- name: Upload PDF
80+
uses: actions/upload-artifact@v4
81+
with:
82+
name: ${{ matrix.directory }}
83+
path: ${{ matrix.directory }}/dist/*.pdf

.github/workflows/makefile.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

.github/workflows/publish.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Publish PDFs
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: pages
15+
cancel-in-progress: true
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
21+
container:
22+
image: ghcr.io/xu-cheng/texlive-full:latest
23+
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
- name: Build bylaws
28+
run: make -C bylaws public
29+
30+
- name: Build policies
31+
run: make -C policies public
32+
33+
- name: Build board-procedures
34+
run: make -C board-procedures public
35+
36+
- name: Prepare Pages content
37+
run: |
38+
mkdir site
39+
40+
cp bylaws/dist/*.pdf site/
41+
cp policies/dist/*.pdf site/
42+
cp board-procedures/dist/*.pdf site/
43+
44+
- name: Upload Pages artifact
45+
uses: actions/upload-pages-artifact@v3
46+
with:
47+
path: site
48+
49+
deploy:
50+
needs: build
51+
52+
runs-on: ubuntu-latest
53+
54+
environment:
55+
name: github-pages
56+
url: ${{ steps.deployment.outputs.page_url }}
57+
58+
permissions:
59+
pages: write
60+
id-token: write
61+
62+
steps:
63+
- name: Deploy to GitHub Pages
64+
id: deployment
65+
uses: actions/deploy-pages@v4

board-procedures/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ all: public
2424
touch .refresh
2525

2626
$(DIST_FOLDER):
27-
mkdir ./dist
27+
mkdir -p ./dist
2828

2929
$(COMPILATION_FOLDER):
30-
mkdir ./bin
30+
mkdir -p ./bin
3131

3232
public: $(SOURCES_P)
3333
$(LATEXMK) $(LATEXMKOPT) \

bylaws/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ all: public annotated
2727
touch .refresh
2828

2929
$(DIST_FOLDER):
30-
mkdir ./dist
30+
mkdir -p ./dist
3131

3232
$(COMPILATION_FOLDER):
33-
mkdir ./bin
33+
mkdir -p ./bin
3434

3535
watch: .refresh $(SOURCES_C)
3636
$(LATEXMK) $(LATEXMKOPT) $(CONTINUOUS) \

policies/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ all: public
2525
touch .refresh
2626

2727
$(DIST_FOLDER):
28-
mkdir ./dist
28+
mkdir -p ./dist
2929

3030
$(COMPILATION_FOLDER):
31-
mkdir ./bin
31+
mkdir -p ./bin
3232

3333
watch: .refresh $(SOURCES_C)
3434
$(LATEXMK) $(LATEXMKOPT) $(CONTINUOUS) \

0 commit comments

Comments
 (0)