Skip to content

Commit 1eb7fdd

Browse files
authored
Update main.yml
1 parent 5488217 commit 1eb7fdd

File tree

1 file changed

+49
-10
lines changed

1 file changed

+49
-10
lines changed

.github/workflows/main.yml

Lines changed: 49 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,61 @@
11
name: Deploy to GitHub Pages
2-
# Run workflow on every push to the master branch
2+
33
on:
44
push:
55
branches: [ main ]
6+
workflow_dispatch:
7+
8+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
# Allow one concurrent deployment
15+
concurrency:
16+
group: "pages"
17+
cancel-in-progress: true
618

719
jobs:
8-
deploy-to-github-pages:
9-
# use ubuntu-latest image to run steps on
20+
build:
1021
runs-on: ubuntu-latest
22+
1123
steps:
12-
#uses GitHub's checkout action to checkout code form the master branch
13-
- uses: actions/checkout@v2
14-
# sets up .NET Core SDK 3.1
24+
- uses: actions/checkout@v4
25+
1526
- name: Setup .NET Core SDK
16-
uses: actions/setup-dotnet@v1
27+
uses: actions/setup-dotnet@v4
1728
with:
18-
dotnet-version: 8.0.0
19-
20-
# publishes Blazor project to the release-folder
29+
dotnet-version: 8.0.x
30+
2131
- name: Publish .NET Core Project
2232
run: dotnet publish ModalAccessibilityTest.csproj -c Release -o release --nologo
33+
34+
# Fix base path for GitHub Pages (CRITICAL for your app to work!)
35+
- name: Change base-tag in index.html
36+
run: sed -i 's/<base href="\/" \/>/<base href="\/Blazor-Modal-Accessibility-Testing\/" \/>/g' release/wwwroot/index.html
37+
38+
# Add .nojekyll file to tell GitHub Pages to not process this as a Jekyll site
39+
- name: Add .nojekyll file
40+
run: touch release/wwwroot/.nojekyll
41+
42+
# Copy index.html to 404.html for SPA routing
43+
- name: Copy index.html to 404.html
44+
run: cp release/wwwroot/index.html release/wwwroot/404.html
45+
46+
- name: Upload artifact
47+
uses: actions/upload-pages-artifact@v3
48+
with:
49+
path: release/wwwroot
50+
51+
# Deploy job
52+
deploy:
53+
environment:
54+
name: github-pages
55+
url: ${{ steps.deployment.outputs.page_url }}
56+
runs-on: ubuntu-latest
57+
needs: build
58+
steps:
59+
- name: Deploy to GitHub Pages
60+
id: deployment
61+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)