-
Notifications
You must be signed in to change notification settings - Fork 3
111 lines (103 loc) · 4.31 KB
/
DocFXPublish.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
104
105
106
107
108
109
110
111
# Simple workflow for generating DocFx Content and publish to GitHub Pages
name: Generate and Publish DocFx Content
on:
# Runs on pushes targeting the default branch and impacting either the src_stripped, docfx_project, public, or DLL_stripped folders
push:
branches: ["main"]
paths: ["src_stripped/**", "docfx_project/**", "public/**", "DLL_stripped/**"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: write
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in progress and the latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Move XML file
run: |
move DLL_stripped\Assembly-CSharp-stripped.xml DLL_stripped\Assembly-CSharp-stripped.xml.bak
dir DLL_stripped
shell: cmd
- name: Generate XML Documentation Directly with Rename
run: |
GenDoc\GenDoc.exe src_stripped\Assembly-CSharp-Stripped.sln DLL_stripped
move DLL_stripped\Assembly-CSharp.xml DLL_stripped\Assembly-CSharp-stripped.xml
dir DLL_stripped
shell: cmd
- name: Check XML file
run: dir DLL_stripped
shell: cmd
- name: Upload Assembly-CSharp.xml Artifact
uses: actions/upload-artifact@v3
with:
name: Assembly-CSharp-stripped.xml
path: DLL_stripped/Assembly-CSharp-stripped.xml
publish-docs:
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Chekout
uses: actions/checkout@v3
- name: Move old Assembly-CSharp-stripped.xml
run: |
mv DLL_stripped/Assembly-CSharp-stripped.xml DLL_stripped/Assembly-CSharp-stripped.xml.bak
ls -l DLL_stripped
oldSize=$(find "DLL_stripped/Assembly-CSharp-stripped.xml.bak" -printf "%s")
echo "oldSize=$(find "DLL_stripped/Assembly-CSharp-stripped.xml.bak" -printf "%s")" >> "$GITHUB_ENV"
echo "${{ env.oldSize }}"
- name: Download Assembly-CSharp-stripped.xml Artifact
uses: actions/download-artifact@v3
with:
name: Assembly-CSharp-stripped.xml
path: DLL_stripped
- name: Compare old Assembly-CSharp-stripped.xml to new
run: |
ls -l DLL_stripped
newSize=$(find "DLL_stripped/Assembly-CSharp-stripped.xml" -printf "%s")
echo "newSize=$(find "DLL_stripped/Assembly-CSharp-stripped.xml" -printf "%s")" >> "$GITHUB_ENV"
now=$(date +%Y.%m.%d)
echo "now=$(date +%Y.%m.%d)" >> "$GITHUB_ENV"
# fileTime=$(find -name "DLL_stripped/Assembly-CSharp-stripped.xml" -prune -printf '%TY.%Tm.%Td\n')
# echo "fileTime=$(find -name DLL_stripped/Assembly-CSharp-stripped.xml -prune -printf '%TY.%Tm.%Td\n')" >> "$GITHUB_ENV"
fileTime=$(date -r "DLL_stripped/Assembly-CSharp-stripped.xml" "+%Y.%m.%d.%H.%M")
echo "fileTime=$(date -r "DLL_stripped/Assembly-CSharp-stripped.xml" "+%Y.%m.%d.%H.%M")" >> "$GITHUB_ENV"
echo "${{ env.newSize }}"
echo "${{ env.now }}"
echo "${{ env.fileTime }}"
- name: Dotnet Setup
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.x
- run: dotnet tool update -g docfx
- run: docfx docfx_project/docfx.json
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
# Upload entire repository - FIXME! Why not only upload the parts we need?
path: '.'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
if: ${{ env.newSize != env.oldSize }}
- name: Push Release
uses: ncipollo/release-action@v1
with:
artifacts: "DLL_stripped/Assembly-CSharp-stripped.xml"
body: "* Updated XML Documentation"
tag: "${{ env.fileTime }}"
commit: "main"