File tree Expand file tree Collapse file tree 5 files changed +60
-32
lines changed
Expand file tree Collapse file tree 5 files changed +60
-32
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ permissions:
1919
2020# Cancel in-progress builds for new pushes to the branch
2121concurrency :
22- group : pages-build-${{ github.ref_name }}
22+ group : pages-build-html- ${{ github.ref_name }}
2323 cancel-in-progress : true
2424
2525jobs :
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 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 :
Original file line number Diff line number Diff line change 88 workflow_run :
99 workflows :
1010 - " Build HTML slides"
11+ - " Build HTML and PDF slides"
1112 types :
1213 - completed
1314
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'
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments