-
Notifications
You must be signed in to change notification settings - Fork 155
143 lines (140 loc) · 4.99 KB
/
build-process.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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
name: NUnit Documentation Build Process
on:
push:
branches:
- master
pull_request:
branches:
- master
env:
NUNIT_VERSION_FOR_API_DOCS: "4.2.2"
jobs:
linting:
name: "Markdown linting"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
name: Check out the code
- uses: actions/setup-node@v4
name: Setup node
with:
node-version: "18"
- run: npm install -g markdownlint-cli2
name: Install markdownlint-cli2
- run: markdownlint-cli2 --config ".github/linters/.markdownlint.yml" "docs/**/*.md"
name: run Markdownlint
spellcheck:
name: "Spell check"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
name: Check out the code
- uses: actions/setup-node@v4
name: Setup node
with:
node-version: "18"
- run: npm install -g cspell
name: Install cSpell
- run: cspell --config ./cSpell.json "docs/**/*.md" --no-progress
name: run cSpell
build:
name: "Build the site with docfx"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
name: Check out the code
- name: Get latest NUnit Asset dir
uses: dsaltares/fetch-gh-release-asset@master
with:
repo: 'nunit/nunit'
version: 'tags/${{ env.NUNIT_VERSION_FOR_API_DOCS }}'
file: 'NUnit.Framework-${{ env.NUNIT_VERSION_FOR_API_DOCS }}.zip'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Unzip NUnit Asset zip file into its own directory
run: unzip NUnit.Framework-${{ env.NUNIT_VERSION_FOR_API_DOCS }}.zip -d ./NUnit.Framework-${{ env.NUNIT_VERSION_FOR_API_DOCS }}
- name: Copy NUnit Asset dir
run: mkdir ./code-output && cp -r ./NUnit.Framework-${{ env.NUNIT_VERSION_FOR_API_DOCS }}/bin/net6.0/* ./code-output
- uses: "nunit/[email protected]"
name: Build with Docfx
with:
args: docs/docfx.json --warningsAsErrors true
- name: zip site contents
run: zip -r _site.zip docs/_site/
- name: Archive site artifacts
uses: actions/upload-artifact@v4
with:
name: siteArtifact
path: _site.zip
- name: Start deployment (PR only)
if: ${{ github.ref != 'refs/heads/master'}}
uses: bobheadxi/deployments@v1
id: deployment
with:
env: preview_${{github.event.number}}
step: start
token: ${{ secrets.SEAN_PAT_TO_MANAGE_ENVIRONMENTS }}
- name: Deploy to Netlify (PR only)
if: ${{ github.ref != 'refs/heads/master'}}
uses: South-Paw/action-netlify-cli@v2
id: netlify
with:
# note that the --json flag has been passed so we can parse outputs
args: deploy --json --dir './docs/_site' --message 'preview [${{ github.sha }}]'
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
- name: Update Preview link comment
if: ${{ github.ref != 'refs/heads/master'}}
uses: marocchino/sticky-pull-request-comment@v2
with:
header: previewlink
message: |
Preview link: ${{ fromJson(steps.netlify.outputs.NETLIFY_OUTPUT).deploy_url }}
- name: Finish deployment
uses: bobheadxi/deployments@v1
if: ${{ github.ref != 'refs/heads/master'}}
with:
env: ${{ steps.deployment.outputs.env }}
step: finish
status: ${{ job.status }}
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
env_url: ${{ fromJson(steps.netlify.outputs.NETLIFY_OUTPUT).deploy_url }}
token: ${{ secrets.SEAN_PAT_TO_MANAGE_ENVIRONMENTS }}
snippets:
name: "Build/Test Snippets"
runs-on: ubuntu-latest
env:
SOLUTION_LOCATION: "./docs/snippets/Snippets.sln"
steps:
- name: Check out the code
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.x
- name: Restore dependencies
run: dotnet restore $SOLUTION_LOCATION
- name: Build
run: dotnet build --no-restore $SOLUTION_LOCATION
- name: Test
run: dotnet test --no-build --verbosity normal $SOLUTION_LOCATION
publish:
name: Publish (master branch only)
needs: [linting, spellcheck, build]
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/master'}}
steps:
- name: Download site artifacts
uses: actions/download-artifact@v4
with:
name: siteArtifact
- name: unzip site contents
run: unzip _site.zip
- name: Push to gh-pages branch (master only)
if: ${{ github.ref == 'refs/heads/master'}}
uses: peaceiris/actions-gh-pages@v4
with:
commit_message: ${{ github.event.head_commit.message }}
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_site
publish_branch: gh-pages