-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (65 loc) · 2.12 KB
/
Copy pathgithub-pages.yml
File metadata and controls
79 lines (65 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: Publish Sample to GitHub Pages
on:
push:
branches:
- main
paths:
- samples/**
- wwwroot/**
- .github/workflows/github-pages.yml
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Build static site artifact
run: |
set -euo pipefail
rm -rf _site
mkdir -p _site
# Start with the sample page as the site root.
cp samples/index.html _site/index.html
# Rewrite sample-relative references so they resolve on GitHub Pages.
sed -i 's|../../wwwroot/|./wwwroot/|g' _site/index.html
# Copy explicitly known build outputs.
mkdir -p _site/wwwroot
cp wwwroot/blazor-markdown-editor.css _site/wwwroot/blazor-markdown-editor.css
cp wwwroot/blazor-markdown-editor.js _site/wwwroot/blazor-markdown-editor.js
cp wwwroot/blazor-markdown-editor.js.map _site/wwwroot/blazor-markdown-editor.js.map
# Copy any additional local src/href references used by the sample.
grep -Eo '(src|href)="[^"]+"' _site/index.html \
| sed -E 's/^(src|href)="([^"]+)"$/\2/' \
| grep -Ev '^(https?:|//|#|data:|mailto:|tel:|javascript:)' \
| while IFS= read -r ref; do
ref="${ref#./}"
[ -n "$ref" ] || continue
[ -f "$ref" ] || continue
mkdir -p "_site/$(dirname "$ref")"
cp "$ref" "_site/$ref"
done
touch _site/.nojekyll
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v4
with:
path: _site
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4