@@ -12,28 +12,55 @@ jobs:
1212
1313 steps :
1414 - uses : actions/checkout@v2
15-
15+
1616 - name : Create gh-pages directory
1717 run : mkdir -p generation/gh-pages
18-
18+
1919 - name : Install dependencies
2020 run : sudo apt-get install m4 graphviz
21-
22- - name : Generate SVG
23- run : m4 flowchart.dot.m4 | dot -Tsvg -start=1000 > generation/gh-pages/initialization.svg
24-
25- - name : Generate PNG
26- run : m4 flowchart.dot.m4 | dot -Tpng -start=1000 > generation/gh-pages/initialization.png
27-
28- - name : Deploy generated to Github Pages
29- 21+
22+ - name : " Generate C++20 flowcharts"
23+ run : |
24+ out='generation/gh-pages/std-2020'
25+ mkdir -- "$out"
26+
27+ m4 cpp20/flowchart.dot.m4 | dot -Tsvg -start=1000 > "$out"/initialization.svg
28+ m4 cpp20/flowchart.dot.m4 | dot -Tpng -start=1000 > "$out"/initialization.png
29+
30+ # Backwards compatibility with old output.
31+ ln -s -- "$out/initialization.svg" generation/gh-pages/initialization.svg
32+ ln -s -- "$out/initialization.png" generation/gh-pages/initialization.png
33+
34+ - name : " Generate C++23 flowcharts"
35+ run : |
36+ out='generation/gh-pages/std-2023'
37+ mkdir -- "$out"
38+
39+ cat cpp23/flowchart.dot.cpp | gcc -E - | dot -Tsvg -start=1000 > "$out"/initialization.svg
40+ cat cpp23/flowchart.dot.cpp | gcc -E - | dot -Tpng -start=1000 > "$out"/initialization.png
41+
42+ - name : Deploy generated flowcharts to Github Pages
3043 if : github.ref == 'refs/heads/main'
31- with :
32- target_branch : gh-pages
33- keep_history : true
34- allow_empty_commit : false
35- build_dir : " generation/gh-pages"
36- author :
" ci-build <[email protected] >" 37- commit_message : " [skip ci] CI Updates"
38- env :
39- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
44+ run : |
45+ # Set Git committer identity
46+ git config user.name "ci-build"
47+ git config user.email "[email protected] " 48+
49+ # Clear the index
50+ EMPTY_TREE="$(git hash-object -t tree /dev/null)"
51+ git read-tree -- "$EMPTY_TREE"
52+
53+ # Add site data to index
54+ git add generation/gh-pages
55+
56+ git fetch origin gh-pages
57+ ORIG_SITE_TREE="$(git rev-parse origin/gh-pages^{tree})"
58+ NEW_SITE_TREE="$(git write-tree --prefix=generation/gh-pages)"
59+
60+ if [ "$ORIG_SITE_TREE" != "$NEW_SITE_TREE" ]; then
61+ SITE_COMMIT="$(git commit-tree -p origin/gh-pages -m "CI updates" -- "$NEW_SITE_TREE")"
62+ echo Updating GitHub pages site to commit "$SITE_COMMIT"
63+ git push origin "$SITE_COMMIT":gh-pages
64+ else
65+ echo Not updating GitHub pages site
66+ fi
0 commit comments