-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (36 loc) · 1.48 KB
/
deploy.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
39
40
41
42
43
44
45
46
name: 'Publish application'
on: push
jobs:
build:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
runs-on: ubuntu-latest
env:
PUBLISH_FOLDER: /home/runner/work/Demos/Demos/Demos/bin/Release/net8.0/publish/wwwroot
name: Build and Deploy Job
steps:
- name: Set the name of the repo in env variable
run: echo "REPO_NAME=${{ github.event.repository.name }}" >> $GITHUB_ENV
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Publish the website in its release form
run: |
dotnet workload install wasm-tools
dotnet publish --configuration Release -p:GHPAGES=1
- name: Change base-tag
run: sed -i 's/<base href="\/" \/>/<base href="\/Demos\/" \/>/g' $PUBLISH_FOLDER/index.html
- name: Copy index.html to 404.html
run: cp $PUBLISH_FOLDER/index.html $PUBLISH_FOLDER/404.html
- name: Add .nojekyll file
run: touch $PUBLISH_FOLDER/.nojekyll
- name: Deploy GitHub Pages action
if: ${{ github.ref == 'refs/heads/main' }}
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.G_TOKEN }}
publish_branch: gh-pages
publish_dir: ${{ env.PUBLISH_FOLDER }}
allow_empty_commit: false
keep_files: false
force_orphan: true