-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (51 loc) · 1.71 KB
/
deploy.yml
File metadata and controls
61 lines (51 loc) · 1.71 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
name: Deploy to GitHub Pages
on:
push:
branches: [ main ]
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Publish
run: dotnet publish SQL-Practice/SQL-Practice.csproj -c Release -o release --nologo
- name: Fix permissions
run: chmod -R 755 release/wwwroot
- name: Set base href for GitHub Pages
run: sed -i 's|<base href="/" />|<base href="/SQL-Practice-Web/" />|g' release/wwwroot/index.html
- name: Add .nojekyll
run: touch release/wwwroot/.nojekyll
- name: Create 404.html for SPA routing
run: |
cat > release/wwwroot/404.html << 'EOF'
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>SQL Practice</title>
<script>
var pathSegmentsToKeep = 1;
var l = window.location;
l.replace(
l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') +
l.pathname.split('/').slice(0, 1 + pathSegmentsToKeep).join('/') + '/?/' +
l.pathname.slice(1).split('/').slice(pathSegmentsToKeep).join('/').replace(/&/g, '~and~') +
(l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '') +
l.hash
);
</script>
</head>
<body></body>
</html>
EOF
- name: Deploy
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: release/wwwroot