@@ -47,17 +47,61 @@ jobs:
47
47
rustc --version
48
48
49
49
- name : ✂ Replace template in <head> of index.html
50
+ if : github.ref != 'refs/heads/master'
51
+ env :
52
+ INDEX_HTML_HEAD_REPLACEMENT : " "
50
53
run : |
51
54
# Remove the INDEX_HTML_HEAD_REPLACEMENT environment variable for build links (not master deploys)
52
- git rev-parse --abbrev-ref HEAD | grep master > /dev/null || export INDEX_HTML_HEAD_REPLACEMENT=""
53
55
sed -i "s|<!-- INDEX_HTML_HEAD_REPLACEMENT -->|$INDEX_HTML_HEAD_REPLACEMENT|" frontend/index.html
54
56
55
57
- name : 🌐 Build Graphite web code
56
58
env :
57
59
NODE_ENV : production
58
60
run : |
59
61
cd frontend
60
- mold -run npm run build
62
+ mold -run npm run
63
+
64
+ - name : 📃 Generate code documentation info for website
65
+ # if: github.ref == 'refs/heads/master'
66
+ run : |
67
+ cargo test --package graphite-editor --lib -- messages::message::test::generate_message_tree
68
+ mkdir -p artifacts-generated
69
+ mv hierarchical_message_system_tree.txt artifacts-generated/hierarchical_message_system_tree.txt
70
+
71
+ - name : 💿 Obtain cache of auto-generated code docs artifacts, to check if they've changed
72
+ id : cache-website-code-docs
73
+ uses : actions/cache/restore@v3
74
+ with :
75
+ path : artifacts
76
+ key : website-code-docs-${{ runner.os }}
77
+
78
+ - name : 🔍 Check if auto-generated code docs artifacts changed
79
+ id : website-code-docs-changed
80
+ run : |
81
+ if ! diff --brief --recursive artifacts-generated artifacts; then
82
+ echo "Auto-generated code docs artifacts have changed."
83
+ rm -rf artifacts
84
+ mv artifacts-generated artifacts
85
+ echo "changed=true" >> $GITHUB_OUTPUT
86
+ else
87
+ echo "Auto-generated code docs artifacts have not changed."
88
+ rm -rf artifacts
89
+ rm -rf artifacts-generated
90
+ fi
91
+
92
+ - name : 💾 Save cache of auto-generated code docs artifacts
93
+ if : steps.website-code-docs-changed.outputs.changed == 'true'
94
+ uses : actions/cache/save@v3
95
+ with :
96
+ path : artifacts
97
+ key : ${{ steps.cache-website-code-docs.outputs.cache-primary-key }}
98
+
99
+ - name : ♻️ Trigger website rebuild if the auto-generated code artifacts have changed
100
+ if : steps.website-code-docs-changed.outputs.changed == 'true'
101
+ env :
102
+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
103
+ run : |
104
+ gh workflow run website.yml --ref master
61
105
62
106
- name : 📤 Publish to Cloudflare Pages
63
107
id : cloudflare
0 commit comments