-
-
Notifications
You must be signed in to change notification settings - Fork 64
121 lines (101 loc) · 3.98 KB
/
docs.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
112
113
114
115
116
117
118
119
120
121
name: Main Build and Deploy Docs
on:
push:
branches:
- main
paths:
# run if any file in the docs folder is pushed
- 'doc/**'
- '.github/workflows/docs.yml'
workflow_run:
branches:
- main
workflows: ["Main Test and Release"]
types:
- completed
jobs:
build_api_reference:
# if not workflow_run, or if workflow was successful
if: github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
# available list of containers here:
# https://hub.docker.com/r/unityci/editor/tags?page=1&ordering=last_updated&name=ubuntu-2020.1.17f1-base
container: unityci/editor:ubuntu-2021.3.5f1-base-3.0.0
steps:
- name: Activate unity
# exit code is 1 for manual activation
continue-on-error: true
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE_2021_3_4 }}
run: |
echo "$UNITY_LICENSE" | tr -d '\r' > UnityLicenseFile.ulf
unity-editor -nographics -logFile /dev/stdout -manualLicenseFile UnityLicenseFile.ulf -quit
- uses: actions/checkout@v4
- name: Cache Library
id: cache-library
uses: actions/cache@v4
with:
path: Library
key: Library-2021.3.5
- name: Generate Solution
run: unity-editor -nographics -logFile /dev/stdout -customBuildName Mirage -projectPath . -executeMethod GitTools.Solution.Sync -quit
# unity 2020.3 outputs <ReferenceOutputAssembly>false</ReferenceOutputAssembly> on linux
# this breaks references to other csproj for docfx and sonar.
# This step is a work around for this so docfx runs in correctly
# replacing false with true in ReferenceOutputAssembly
- name: Fix Csproj
run: sed -i 's/<ReferenceOutputAssembly>false<\/ReferenceOutputAssembly>/<ReferenceOutputAssembly>true<\/ReferenceOutputAssembly>/g' *.csproj
- uses: nikeee/[email protected]
with:
args: metadata --logLevel Warning doc/docfx.json
# Build new api (will update cache when job finishes)
- name: Convert metadata to markdown
uses: fillefilip8/[email protected]
with:
input-folder: doc/api
output-folder: doc/docs/reference
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: metadata
path: doc/docs/reference
build_and_deploy:
needs: build_api_reference
runs-on: ubuntu-latest
container: node:18
steps:
- uses: actions/checkout@v4
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: metadata
path: doc/docs/reference
# copies change log from mirage folder to docs
- name: Copy ChangeLog
# use cat and >> to append to placeholder file
run: cat Assets/Mirage/CHANGELOG.md >> doc/docs/general/CHANGELOG.md
- name: Escape HTML in ChangeLog
run: sed -i 's/&/\&/g; s/</\</g; s/>/\>/g' doc/docs/general/CHANGELOG.md
- name: Install dependencies
working-directory: doc
run: npm ci
- name: Download EmbedCodeInMarkdown
run: curl -LJO https://github.com/James-Frowen/EmbedCodeInMarkdown/releases/download/v1.0.3/EmbedCodeInMarkdown
- name: Run EmbedCodeInMarkdown
run: chmod +x ./EmbedCodeInMarkdown && ./EmbedCodeInMarkdown -docs="doc/docs/" -code="Assets/Mirage/Samples~/"
- name: Build docusaurus
working-directory: doc
run: npm run build
env:
ORG_NAME: ${{ github.repository_owner }}
REPO_NAME: ${{ github.event.repository.name }}
- name: Publish docs
uses: crazy-max/[email protected]
if: github.ref == 'refs/heads/main'
with:
keep_history: false
jekyll: false
# Build directory to deploy
build_dir: doc/build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}