Skip to content

Commit 5efce7e

Browse files
committed
ci: fix index rebuild order [skip ci]
1 parent 371e98a commit 5efce7e

File tree

1 file changed

+26
-17
lines changed

1 file changed

+26
-17
lines changed

.github/index.mjs

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,36 @@ const __readme = paths.join(__metrics, ".github/readme")
2020
const git = sgit(__metrics)
2121
const staged = new Set()
2222

23+
for (const step of ["config", "documentation"]) {
24+
2325
//Load plugins metadata
2426
const {plugins, templates, packaged, descriptor} = await metadata({log:false})
2527

26-
//Update generated files
27-
async function update({source, output, options = {}}) {
28-
//Regenerate file
29-
console.log(`Generating ${output}`)
30-
const content = await ejs.renderFile(source, {plugins, templates, packaged, descriptor}, {async:true, ...options})
31-
//Save result
32-
const file = paths.join(__metrics, output)
33-
await fs.writeFile(file, content)
34-
//Add to git
35-
staged.add(file)
36-
}
28+
//Update generated files
29+
async function update({source, output, options = {}}) {
30+
//Regenerate file
31+
console.log(`Generating ${output}`)
32+
const content = await ejs.renderFile(source, {plugins, templates, packaged, descriptor}, {async:true, ...options})
33+
//Save result
34+
const file = paths.join(__metrics, output)
35+
await fs.writeFile(file, content)
36+
//Add to git
37+
staged.add(file)
38+
}
3739

38-
//Rendering
39-
await update({source:paths.join(__readme, "README.md"), output:"README.md", options:{root:__readme}})
40-
await update({source:paths.join(__readme, "partials/documentation/plugins.md"), output:"source/plugins/README.md"})
41-
await update({source:paths.join(__readme, "partials/documentation/templates.md"), output:"source/templates/README.md"})
42-
await update({source:paths.join(__action, "action.yml"), output:"action.yml"})
43-
await update({source:paths.join(__web, "settings.example.json"), output:"settings.example.json"})
40+
//Templating
41+
switch (step) {
42+
case "config":
43+
await update({source:paths.join(__action, "action.yml"), output:"action.yml"})
44+
await update({source:paths.join(__web, "settings.example.json"), output:"settings.example.json"})
45+
break
46+
case "documentation":
47+
await update({source:paths.join(__readme, "README.md"), output:"README.md", options:{root:__readme}})
48+
await update({source:paths.join(__readme, "partials/documentation/plugins.md"), output:"source/plugins/README.md"})
49+
await update({source:paths.join(__readme, "partials/documentation/templates.md"), output:"source/templates/README.md"})
50+
break
51+
}
52+
}
4453

4554
//Commit and push
4655
if (mode === "publish") {

0 commit comments

Comments
 (0)