File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,12 +31,35 @@ jobs:
3131
3232 - name : Build static site artifact
3333 run : |
34- set -e
35- mkdir -p _site/wwwroot
34+ set -euo pipefail
35+
36+ rm -rf _site
37+ mkdir -p _site
38+
39+ # Start with the sample page as the site root.
3640 cp samples/blazer-editor-test/index.html _site/index.html
41+
42+ # Rewrite sample-relative references so they resolve on GitHub Pages.
43+ sed -i 's|../../wwwroot/|./wwwroot/|g' _site/index.html
44+
45+ # Copy explicitly known build outputs.
46+ mkdir -p _site/wwwroot
3747 cp wwwroot/blazer-markdown-editor.css _site/wwwroot/blazer-markdown-editor.css
3848 cp wwwroot/blazer-markdown-editor.js _site/wwwroot/blazer-markdown-editor.js
3949 cp wwwroot/blazer-markdown-editor.js.map _site/wwwroot/blazer-markdown-editor.js.map
50+
51+ # Copy any additional local src/href references used by the sample.
52+ grep -Eo '(src|href)="[^"]+"' _site/index.html \
53+ | sed -E 's/^(src|href)="([^"]+)"$/\2/' \
54+ | grep -Ev '^(https?:|//|#|data:|mailto:|tel:|javascript:)' \
55+ | while IFS= read -r ref; do
56+ ref="${ref#./}"
57+ [ -n "$ref" ] || continue
58+ [ -f "$ref" ] || continue
59+ mkdir -p "_site/$(dirname "$ref")"
60+ cp "$ref" "_site/$ref"
61+ done
62+
4063 touch _site/.nojekyll
4164
4265 - name : Upload Pages artifact
You can’t perform that action at this time.
0 commit comments