ci: fix index rebuild order [skip ci]
This commit is contained in:
27
.github/index.mjs
vendored
27
.github/index.mjs
vendored
@@ -20,11 +20,13 @@ const __readme = paths.join(__metrics, ".github/readme")
|
|||||||
const git = sgit(__metrics)
|
const git = sgit(__metrics)
|
||||||
const staged = new Set()
|
const staged = new Set()
|
||||||
|
|
||||||
|
for (const step of ["config", "documentation"]) {
|
||||||
|
|
||||||
//Load plugins metadata
|
//Load plugins metadata
|
||||||
const {plugins, templates, packaged, descriptor} = await metadata({log:false})
|
const {plugins, templates, packaged, descriptor} = await metadata({log:false})
|
||||||
|
|
||||||
//Update generated files
|
//Update generated files
|
||||||
async function update({source, output, options = {}}) {
|
async function update({source, output, options = {}}) {
|
||||||
//Regenerate file
|
//Regenerate file
|
||||||
console.log(`Generating ${output}`)
|
console.log(`Generating ${output}`)
|
||||||
const content = await ejs.renderFile(source, {plugins, templates, packaged, descriptor}, {async:true, ...options})
|
const content = await ejs.renderFile(source, {plugins, templates, packaged, descriptor}, {async:true, ...options})
|
||||||
@@ -33,14 +35,21 @@ async function update({source, output, options = {}}) {
|
|||||||
await fs.writeFile(file, content)
|
await fs.writeFile(file, content)
|
||||||
//Add to git
|
//Add to git
|
||||||
staged.add(file)
|
staged.add(file)
|
||||||
}
|
}
|
||||||
|
|
||||||
//Rendering
|
//Templating
|
||||||
await update({source:paths.join(__readme, "README.md"), output:"README.md", options:{root:__readme}})
|
switch (step) {
|
||||||
await update({source:paths.join(__readme, "partials/documentation/plugins.md"), output:"source/plugins/README.md"})
|
case "config":
|
||||||
await update({source:paths.join(__readme, "partials/documentation/templates.md"), output:"source/templates/README.md"})
|
await update({source:paths.join(__action, "action.yml"), output:"action.yml"})
|
||||||
await update({source:paths.join(__action, "action.yml"), output:"action.yml"})
|
await update({source:paths.join(__web, "settings.example.json"), output:"settings.example.json"})
|
||||||
await update({source:paths.join(__web, "settings.example.json"), output:"settings.example.json"})
|
break
|
||||||
|
case "documentation":
|
||||||
|
await update({source:paths.join(__readme, "README.md"), output:"README.md", options:{root:__readme}})
|
||||||
|
await update({source:paths.join(__readme, "partials/documentation/plugins.md"), output:"source/plugins/README.md"})
|
||||||
|
await update({source:paths.join(__readme, "partials/documentation/templates.md"), output:"source/templates/README.md"})
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Commit and push
|
//Commit and push
|
||||||
if (mode === "publish") {
|
if (mode === "publish") {
|
||||||
|
|||||||
Reference in New Issue
Block a user