4
4
push :
5
5
branches :
6
6
- master
7
- pull_request :
7
+ pull_request : {}
8
8
env :
9
9
CARGO_TERM_COLOR : always
10
10
INDEX_HTML_HEAD_REPLACEMENT : <script defer data-domain="dev.graphite.rs" data-api="https://graphite.rs/visit/event" src="https://graphite.rs/visit/script.hash.js"></script>
13
13
build :
14
14
runs-on : self-hosted
15
15
permissions :
16
- contents : read
16
+ contents : write
17
17
deployments : write
18
18
pull-requests : write
19
+ actions : write
19
20
env :
20
21
RUSTC_WRAPPER : /usr/bin/sccache
21
22
CARGO_INCREMENTAL : 0
47
48
rustc --version
48
49
49
50
- name : ✂ Replace template in <head> of index.html
51
+ if : github.ref != 'refs/heads/master'
52
+ env :
53
+ INDEX_HTML_HEAD_REPLACEMENT : " "
50
54
run : |
51
55
# 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
56
sed -i "s|<!-- INDEX_HTML_HEAD_REPLACEMENT -->|$INDEX_HTML_HEAD_REPLACEMENT|" frontend/index.html
54
57
55
58
- name : 🌐 Build Graphite web code
70
73
projectName : graphite-dev
71
74
directory : frontend/dist
72
75
76
+ - name : 💬 Comment build link URL to commit hash page on GitHub
77
+ if : github.ref == 'refs/heads/master'
78
+ env :
79
+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
80
+ run : |
81
+ gh api \
82
+ -X POST \
83
+ -H "Accept: application/vnd.github+json" \
84
+ /repos/${{ github.repository }}/commits/$(git rev-parse HEAD)/comments \
85
+ -f body="| 📦 **Build Complete for** $(git rev-parse HEAD) |
86
+ |-|
87
+ | ${{ steps.cloudflare.outputs.url }} |"
88
+
73
89
- name : 👕 Lint Graphite web formatting
74
90
env :
75
91
NODE_ENV : production
@@ -91,6 +107,49 @@ jobs:
91
107
run : |
92
108
mold -run cargo test --all-features --workspace
93
109
110
+ - name : 📃 Generate code documentation info for website
111
+ # if: github.ref == 'refs/heads/master'
112
+ run : |
113
+ cargo test --package graphite-editor --lib -- messages::message::test::generate_message_tree
114
+ mkdir -p artifacts-generated
115
+ mv hierarchical_message_system_tree.txt artifacts-generated/hierarchical_message_system_tree.txt
116
+
117
+ - name : 💿 Obtain cache of auto-generated code docs artifacts, to check if they've changed
118
+ id : cache-website-code-docs
119
+ uses : actions/cache/restore@v3
120
+ with :
121
+ path : artifacts
122
+ key : website-code-docs
123
+
124
+ - name : 🔍 Check if auto-generated code docs artifacts changed
125
+ id : website-code-docs-changed
126
+ run : |
127
+ if ! diff --brief --recursive artifacts-generated artifacts; then
128
+ echo "Auto-generated code docs artifacts have changed."
129
+ rm -rf artifacts
130
+ mv artifacts-generated artifacts
131
+ echo "changed=true" >> $GITHUB_OUTPUT
132
+ else
133
+ echo "Auto-generated code docs artifacts have not changed."
134
+ rm -rf artifacts
135
+ rm -rf artifacts-generated
136
+ fi
137
+
138
+ - name : 💾 Save cache of auto-generated code docs artifacts
139
+ if : steps.website-code-docs-changed.outputs.changed == 'true'
140
+ uses : actions/cache/save@v3
141
+ with :
142
+ path : artifacts
143
+ key : ${{ steps.cache-website-code-docs.outputs.cache-primary-key }}
144
+
145
+ - name : ♻️ Trigger website rebuild if the auto-generated code docs artifacts have changed
146
+ if : steps.website-code-docs-changed.outputs.changed == 'true'
147
+ env :
148
+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
149
+ run : |
150
+ rm -rf artifacts
151
+ gh workflow run website.yml --ref master
152
+
94
153
# miri:
95
154
# runs-on: self-hosted
96
155
0 commit comments