-
-
Notifications
You must be signed in to change notification settings - Fork 39
103 lines (100 loc) · 3.53 KB
/
documentation_test.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
91
92
93
94
95
96
97
98
99
100
101
102
103
name: "Test Documentation"
on:
pull_request:
merge_group:
env:
DOTNET_NOLOGO: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: true
GH_TOKEN: ${{ github.token }}
jobs:
build:
timeout-minutes: 25
runs-on: ubuntu-latest
name: Build documentation
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.NYUW_TOKEN_GH }}
- name: Checkout PR if nessesary
if: github.event_name == 'pull_request'
run: gh pr checkout ${{ github.event.pull_request.number }}
- name: Setup .NET
uses: actions/[email protected]
with:
dotnet-version: 7.0.400
- name: Install DocFX
run: dotnet tool update -g docfx --prerelease
continue-on-error: true
- name: Restore packages
run: dotnet restore DisCatSharp.sln
- name: Build library
run: dotnet build -c Release -v minimal -f net7.0 --no-restore DisCatSharp.sln
timeout-minutes: 7
continue-on-error: true
- name: Build Docs
run: docfx DisCatSharp.Docs/docfx.json --logLevel Verbose
- name: Pack Docs
shell: pwsh
run: ./DisCatSharp.Tools/pack-docs.ps1 -DocsPath "./DisCatSharp.Docs" -OutputPath "./" -PackageName "dcs-docs-preview"
- name: Upload packed docs
uses: actions/upload-artifact@v3
with:
name: dcs-docs-preview.zip
path: dcs-docs-preview.zip
retention-days: 2
test_documentation:
runs-on: ubuntu-latest
name: Test documentation
needs: build
steps:
- name: Dynamically create branch
uses: GuillaumeFalourd/[email protected]
with:
repository_owner: Aiko-IT-Systems
repository_name: DisCatSharp.Docs
new_branch_name: ${{ github.head_ref }}
access_token: ${{ secrets.NYUW_TOKEN_GH }}
ignore_branch_exists: true
git_user_name: NyuwBot
git_user_email: [email protected]
- name: Checkout docs repository
uses: actions/checkout@v4
with:
repository: Aiko-IT-Systems/DisCatSharp.Docs
token: ${{ secrets.NYUW_TOKEN_GH }}
ref: ${{ github.head_ref }}
- name: Purge old docs
shell: pwsh
run: Get-ChildItem -Exclude .git* | Remove-Item -Recurse -Force
- name: Download packed docs
uses: actions/download-artifact@v3
with:
name: dcs-docs-preview.zip
- name: Extract new docs
run: unzip dcs-docs-preview.zip -d .
- name: Deleze zip
run: rm dcs-docs-preview.zip
- name: Add .htaccess
run: rm -f .htaccess && wget https://gist.githubusercontent.com/Lulalaby/8a032d0ddebb9125691094edc67b6593/raw/0c4bf0423cfe334fdd5092b014d2481759dd052a/.htaccess
- name: Set access rights
run: sudo chmod 777 -R .
- name: Commit changes
run: |
git config user.name NyuwBot
git config user.email [email protected]
git add .
git commit -m "Test-Docs update (https://github.com/${{github.repository}}/commit/${{github.sha}})"
git push -f
- name: Add PR Comment
if: always()
uses: mshick/add-pr-comment@v2
with:
refresh-message-position: true
message-success: |
Documentation test build passed! :tada:
Visit the cloudflare action run in https://github.com/Aiko-IT-Systems/DisCatSharp.Docs/commits/${{github.head_ref}} for details :3
![gif](https://media.tenor.com/3PjRNS8paykAAAAC/pat-pat-head.gif)
message-failure: "Documentation test build failed! :x:"