12
12
*/
13
13
import { ProjenStruct , Struct } from '@mrgrain/jsii-struct-builder' ;
14
14
import { JsonPatch , awscdk } from 'projen' ;
15
+ import { JobPermission } from 'projen/lib/github/workflows-model' ;
15
16
import { NpmAccess } from 'projen/lib/javascript' ;
16
17
import {
17
18
buildMeritBadgerWorkflow ,
@@ -103,6 +104,9 @@ const project = new awscdk.AwsCdkConstructLibrary({
103
104
'!.ort.yml' ,
104
105
'.idea' ,
105
106
'.vscode' ,
107
+ 'website/build' ,
108
+ 'website/node_modules' ,
109
+ 'website/.docusaurus' ,
106
110
] ,
107
111
stability : 'experimental' ,
108
112
sampleCode : false ,
@@ -138,6 +142,71 @@ project.github?.actions.set('peter-evans/create-issue-from-file@v4', 'peter-evan
138
142
project . github ?. actions . set ( 'peter-evans/create-pull-request@v4' , 'peter-evans/create-pull-request@38e0b6e68b4c852a5500a94740f0e535e0d7ba54' ) ;
139
143
project . github ?. actions . set ( 'peter-evans/create-pull-request@v5' , 'peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38' ) ;
140
144
project . github ?. actions . set ( 'aws-actions/[email protected] ' , 'aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502' ) ;
145
+ // docusaurus add specific overrides
146
+
147
+ project . github ?. actions . set ( 'peaceiris/actions-gh-pages@v3' , 'peaceiris/actions-gh-pages@373f7f263a76c20808c831209c920827a82a2847' ) ;
148
+ project ;
149
+ const deployDocsWorkflow = project . github ?. addWorkflow ( 'DeployDocs' ) ;
150
+ if ( deployDocsWorkflow ) {
151
+ deployDocsWorkflow . on ( {
152
+ push : {
153
+ branches : [ 'main' ] ,
154
+ } ,
155
+ } ) ;
156
+
157
+ project . github ?. actions . set ( 'peaceiris/actions-gh-pages@v3' , 'peaceiris/actions-gh-pages@373f7f263a76c20808c831209c920827a82a2847' ) ;
158
+
159
+ deployDocsWorkflow . addJobs ( {
160
+ deploy : {
161
+ permissions : {
162
+ contents : JobPermission . WRITE ,
163
+ } ,
164
+ runsOn : [ 'ubuntu-latest' ] ,
165
+ steps : [
166
+ { uses : 'actions/checkout@v3' } ,
167
+ {
168
+ uses : 'actions/setup-node@v3' ,
169
+ with : { 'node-version' : '18' } ,
170
+ } ,
171
+ { run : 'cd website; yarn install --frozen-lockfile;' } ,
172
+ {
173
+ uses : 'peaceiris/actions-gh-pages@v3' ,
174
+ with : {
175
+ github_token : '${{ secrets.GITHUB_TOKEN }}' ,
176
+ publish_dir : './website/build' ,
177
+ user_name : 'github-actions[bot]' ,
178
+ user_email : '41898282+github-actions[bot]@users.noreply.github.com' ,
179
+ } ,
180
+ } ,
181
+ ] ,
182
+ } ,
183
+ } ) ;
184
+ }
185
+
186
+ const testDeploymentWorkflow = project . github ?. addWorkflow ( 'TestDeployment' ) ;
187
+
188
+ if ( testDeploymentWorkflow ) {
189
+ testDeploymentWorkflow . on ( {
190
+ pullRequest : {
191
+ branches : [ 'main' ] ,
192
+ } ,
193
+ } ) ;
194
+
195
+ testDeploymentWorkflow . addJobs ( {
196
+ test_deploy : {
197
+ permissions : {
198
+ contents : JobPermission . WRITE ,
199
+ } ,
200
+ runsOn : [ 'ubuntu-latest' ] ,
201
+ steps : [
202
+ { uses : 'actions/checkout@v3' , with : { 'fetch-depth' : '0' } } ,
203
+ { uses : 'actions/setup-node@v3' , with : { 'node-version' : '18' , 'cache' : 'yarn' } } ,
204
+ { run : 'cd website; yarn install --frozen-lockfile' } ,
205
+ { run : 'cd website; pwd; npx docusaurus build' , name : 'Test build website' } ,
206
+ ] ,
207
+ } ,
208
+ } ) ;
209
+ }
141
210
142
211
// We don't want to package certain things
143
212
project . npmignore ?. addPatterns (
@@ -157,6 +226,7 @@ project.npmignore?.addPatterns(
157
226
'tsconfig.dev.json' ,
158
227
'yarn.lock' ,
159
228
'/apidocs/' ,
229
+ 'website/' ,
160
230
) ;
161
231
162
232
// Add License header automatically
0 commit comments