-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaction.yml
38 lines (38 loc) · 1.43 KB
/
action.yml
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
name: 'Deploy Blazor to GitHub Pages'
description: 'Build a Blazor Wasm application and deploy it to GitHub Pages.'
inputs:
project_path:
description: 'The path to the Blazor project'
required: false
default: '.'
runs:
using: "composite"
steps:
- name: Substitute base href
run: sed -i 's/base href="\/"/base href="\/${{ github.event.repository.name }}\/"/' ${{ inputs.project_path }}/wwwroot/index.html
shell: bash
- name: Setup SPA 404 page redirection
run: |
cp ${{ github.action_path }}/404.html ${{ inputs.project_path }}/wwwroot
cp ${{ github.action_path }}/redirect.js ${{ inputs.project_path }}/wwwroot
sed -i '/blazor.webassembly.js/i \ <script src="redirect.js"><\/script>' ${{ inputs.project_path }}/wwwroot/index.html
shell: bash
- name: Publish application
run: dotnet publish -c Release -o ${{ runner.temp }}/${{ github.action }}
shell: bash
- name: Create gh-pages branch
run: |
git checkout --orphan gh-pages
git clean -fdx
git rm -rf .
cp -r ${{ runner.temp }}/${{ github.action }}/wwwroot/. .
touch .nojekyll
shell: bash
- name: Commit and push
run: |
git add .
git config user.name github-actions
git config user.email github-actions@github.com
git commit -m 'Deploy application to GitHub Pages'
git push -f -u origin gh-pages
shell: bash