generated from abbatepabloo/MyBlog
-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (37 loc) · 1.31 KB
/
ci.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
name: 'Publish application'
on: push
jobs:
build:
runs-on: ubuntu-latest
steps:
# Checkout the code
- uses: actions/checkout@v2
# Install .NET Core SDK
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
include-prerelease: true
# Replace base href
- name: Replace Href base address
run: sed -i 's/href=\"\/\"/href=\"\/MyBlog\/\"/' MyBlog/wwwroot/index.html
# Duplicate index into 404.html
- name: Copy index.html to 404.html
run: cp MyBlog/wwwroot/index.html MyBlog/wwwroot/404.html
# Run tests
- name: Test
run: dotnet test
# Generate the website
- name: Publish
run: dotnet publish MyBlog/MyBlog.csproj --configuration Release
# Publish the website
- name: GitHub Pages action
if: ${{ github.ref == 'refs/heads/master' }} # Publish only when the push is on master
uses: peaceiris/[email protected]
with:
github_token: ${{ github.token }}
publish_branch: gh-pages
publish_dir: MyBlog/bin/Release/net6.0/publish/wwwroot
allow_empty_commit: false
keep_files: false
force_orphan: true