Skip to content

Commit 385feea

Browse files
committed
Integrate PDF build
1 parent 818e309 commit 385feea

File tree

5 files changed

+60
-32
lines changed

5 files changed

+60
-32
lines changed

.github/workflows/pages-build-html.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ permissions:
1919

2020
# Cancel in-progress builds for new pushes to the branch
2121
concurrency:
22-
group: pages-build-${{ github.ref_name }}
22+
group: pages-build-html-${{ github.ref_name }}
2323
cancel-in-progress: true
2424

2525
jobs:
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# SPDX-FileCopyrightText: 2024 CSC - IT Center for Science Ltd. <www.csc.fi>
2+
#
3+
# SPDX-License-Identifier: MIT
4+
5+
name: Build HTML and PDF slides
6+
7+
on:
8+
push:
9+
branches:
10+
- "*"
11+
paths:
12+
- "**/docs/**"
13+
- "**/about.yml"
14+
- ".github/workflows/pages*.yml"
15+
workflow_dispatch:
16+
17+
permissions:
18+
contents: read
19+
20+
# Cancel in-progress builds for new pushes to the branch
21+
concurrency:
22+
group: pages-build-pdf-${{ github.ref_name }}
23+
cancel-in-progress: true
24+
25+
jobs:
26+
pages:
27+
uses: ./.github/workflows/pages-build.yml
28+
with:
29+
include_pdf: true

.github/workflows/pages-build.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ jobs:
3838
--info_content "Updated for [$GIT_SHORT_SHA]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/commit/$GITHUB_SHA) ($GIT_DATE)" \
3939
$ARGS
4040
41+
# Save commit sha
42+
echo $GITHUB_SHA > build/commit_sha
43+
4144
- name: Upload slide artifact
4245
uses: actions/upload-artifact@v4
4346
with:

.github/workflows/pages-deploy.yml

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
workflow_run:
99
workflows:
1010
- "Build HTML slides"
11+
- "Build HTML and PDF slides"
1112
types:
1213
- completed
1314

@@ -61,9 +62,32 @@ jobs:
6162
mkdir site
6263
fi
6364
64-
echo "- Updating existing pages"
65-
rm -rf site/$BRANCH
66-
mv build site/$BRANCH
65+
# Check if the build included pdfs
66+
if [ -d build/pdf ]; then
67+
# Deploying build including pdfs
68+
# We expect that we are updating html build of the same commit
69+
if diff -q build/commit_sha site/$BRANCH/commit_sha >/dev/null 2>&1; then
70+
# The existing build is for the same commit
71+
# OK to update
72+
echo "- Updating existing pages with PDF build"
73+
rm -rf site/$BRANCH
74+
mv build site/$BRANCH
75+
else
76+
# Something is wrong
77+
echo "ERROR: PDF build is trying to overwrite existing, possibly newer build"
78+
exit 1
79+
fi
80+
else
81+
# Deploying build with html only
82+
# If there exist a build for the same commit, we don't do anything
83+
if diff -q build/commit_sha site/$BRANCH/commit_sha >/dev/null 2>&1; then
84+
echo "- Not updating existing pages"
85+
else
86+
echo "- Updating with new HTML build"
87+
rm -rf site/$BRANCH
88+
mv build site/$BRANCH
89+
fi
90+
fi
6791
6892
# Add redirecting index.html at the root
6993
cat > site/index.html <<'EOF'

.github/workflows/pages-pdf.yml

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

0 commit comments

Comments
 (0)