|
16 | 16 | contents: read
|
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,17 +48,19 @@ jobs:
|
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
|
56 | 59 | env:
|
57 | 60 | NODE_ENV: production
|
58 | 61 | run: |
|
59 | 62 | cd frontend
|
60 |
| - mold -run npm run build |
| 63 | + mold -run npm run |
61 | 64 |
|
62 | 65 | - name: 📤 Publish to Cloudflare Pages
|
63 | 66 | id: cloudflare
|
|
91 | 94 | run: |
|
92 | 95 | mold -run cargo test --all-features --workspace
|
93 | 96 |
|
| 97 | + - name: 📃 Generate code documentation info for website |
| 98 | + # if: github.ref == 'refs/heads/master' |
| 99 | + run: | |
| 100 | + cargo test --package graphite-editor --lib -- messages::message::test::generate_message_tree |
| 101 | + mkdir -p artifacts-generated |
| 102 | + mv hierarchical_message_system_tree.txt artifacts-generated/hierarchical_message_system_tree.txt |
| 103 | +
|
| 104 | + - name: 💿 Obtain cache of auto-generated code docs artifacts, to check if they've changed |
| 105 | + id: cache-website-code-docs |
| 106 | + uses: actions/cache/restore@v3 |
| 107 | + with: |
| 108 | + path: artifacts |
| 109 | + key: website-code-docs |
| 110 | + |
| 111 | + - name: 🔍 Check if auto-generated code docs artifacts changed |
| 112 | + id: website-code-docs-changed |
| 113 | + run: | |
| 114 | + if ! diff --brief --recursive artifacts-generated artifacts; then |
| 115 | + echo "Auto-generated code docs artifacts have changed." |
| 116 | + rm -rf artifacts |
| 117 | + mv artifacts-generated artifacts |
| 118 | + echo "changed=true" >> $GITHUB_OUTPUT |
| 119 | + else |
| 120 | + echo "Auto-generated code docs artifacts have not changed." |
| 121 | + rm -rf artifacts |
| 122 | + rm -rf artifacts-generated |
| 123 | + fi |
| 124 | +
|
| 125 | + - name: 💾 Save cache of auto-generated code docs artifacts |
| 126 | + if: steps.website-code-docs-changed.outputs.changed == 'true' |
| 127 | + uses: actions/cache/save@v3 |
| 128 | + with: |
| 129 | + path: artifacts |
| 130 | + key: ${{ steps.cache-website-code-docs.outputs.cache-primary-key }} |
| 131 | + |
| 132 | + - name: ♻️ Trigger website rebuild if the auto-generated code docs artifacts have changed |
| 133 | + if: steps.website-code-docs-changed.outputs.changed == 'true' |
| 134 | + env: |
| 135 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 136 | + run: | |
| 137 | + rm -rf artifacts |
| 138 | + gh workflow run website.yml --ref master |
| 139 | +
|
94 | 140 | # miri:
|
95 | 141 | # runs-on: self-hosted
|
96 | 142 |
|
|
0 commit comments