Repository navigation
93 lines (75 loc) · 2.84 KB
/
Copy pathgithub-pages.yml
File metadata and controls
93 lines (75 loc) · 2.84 KB
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
91
92
93
name: Publish Documentation Site
on:
push:
branches: [ "master" ]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Setup DocFX
run: dotnet tool update -g docfx
- name: Restore solution
run: dotnet restore TeslaPowerwallLibrary.slnx
- name: Build solution
run: dotnet build TeslaPowerwallLibrary.slnx --configuration Release --no-restore -p:GenerateDocfxDocumentation=false
- name: Run tests (net472)
run: dotnet test TeslaPowerwallLibrary.Tests/TeslaPowerwallLibrary.Tests.csproj --configuration Release --no-build --framework net472 --filter "TestCategory!=Live"
- name: Run tests (net10.0)
run: dotnet test TeslaPowerwallLibrary.Tests/TeslaPowerwallLibrary.Tests.csproj --configuration Release --no-build --framework net10.0 --filter "TestCategory!=Live"
- name: Build metadata and site
shell: pwsh
run: |
$env:PATH += ";$env:USERPROFILE\.dotnet\tools"
docfx docfx_project/docfx.json
- name: Configure Pages
uses: actions/configure-pages@v5
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: docfx_project/_site
deploy:
environment:
name: github-pages
url: ${{ steps.deploy_1.outputs.page_url || steps.deploy_2.outputs.page_url || steps.deploy_3.outputs.page_url }}
runs-on: windows-latest
needs: build
steps:
# actions/deploy-pages@v4 occasionally fails immediately with a generic
# "Deployment failed, try again later." error from the Pages API. This has
# been observed to be transient, so retry a few times with a short delay
# before treating it as a real failure.
- name: Deploy to GitHub Pages (attempt 1)
id: deploy_1
uses: actions/deploy-pages@v4
continue-on-error: true
- name: Wait before retry 1
if: steps.deploy_1.outcome == 'failure'
shell: pwsh
run: Start-Sleep -Seconds 20
- name: Deploy to GitHub Pages (attempt 2)
id: deploy_2
if: steps.deploy_1.outcome == 'failure'
uses: actions/deploy-pages@v4
continue-on-error: true
- name: Wait before retry 2
if: steps.deploy_1.outcome == 'failure' && steps.deploy_2.outcome == 'failure'
shell: pwsh
run: Start-Sleep -Seconds 20
- name: Deploy to GitHub Pages (attempt 3)
id: deploy_3
if: steps.deploy_1.outcome == 'failure' && steps.deploy_2.outcome == 'failure'
uses: actions/deploy-pages@v4