-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (70 loc) · 2.18 KB
/
publish-gh-pages.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: Publish Blazor App to GitHub Pages
on: [ push, workflow_dispatch ]
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: write
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
build_test_artifact:
name: Build App
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup .NET SDK
uses: actions/setup-dotnet@v2
with:
dotnet-version: '7.x'
# - name: Set basepath on index.html
# shell: pwsh
# run: |
# $filepath = "./src/BlazorApp/wwwroot/index.html"
# $repository = "${{ github.repository }}" -replace "${{ github.repository_owner }}", ""
# $html = Get-Content -Path $filepath
# $html -replace "<base href=`"/`" />", "<base href=`"$repository/`" />" | Out-File -Path $filepath -Force
# - name: Set basepath on JSON objects
# shell: pwsh
# run: |
# $filepath = "./src/BlazorApp/wwwroot/sample-data"
# $repository = "${{ github.repository }}" -replace "${{ github.repository_owner }}", ""
# Get-ChildItem -Path $filepath -Filter "*.json" | ForEach-Object {
# $json = Get-Content -Path $_.FullName
# $json.Replace("../", "$repository/") | Out-File -Path $_.FullName -Force
# }
- name: Restore NuGet packages
shell: bash
run: |
dotnet restore .
- name: Build solution
shell: bash
run: |
dotnet build .
- name: Test solution
shell: bash
run: |
dotnet test . -c Release
- name: Publish artifact
shell: bash
run: |
dotnet publish src/BlazorApp -c Release -o published
- name: Upload artifact for web
uses: actions/upload-pages-artifact@v1
with:
path: published/wwwroot
deploy:
name: Deploy App to GitHub Pages
needs:
- build_test_artifact
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1