Branch

Add an optional "artifactSteps" category

Sat Oct 11 2025

Tucker McKnight <tucker@pangolin.lan>

This field in the config allows you to specify a list of build
steps. These build steps will run on every branch in the repo,
then copy a directory into the resulting _site directory for that
given branch.

005a065fd24cdf90fbf1e4d44df8672e9a929eba

Side-by-side
Stacked
main.ts:82
Before
82
After
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
          if (typeof repoConfig.artifactSteps !== 'undefined') {
            // make a temp directory for things to run in
            const tempDirName = `temp_${Math.floor(Math.random() * 10000).toString()}`
            const tempDir = `${directories.output}${reposPath}${tempDirName}`
            const tempDirRepoPath = `${tempDir}/${eleventyConfig.getFilter("slugify")(repoName)}`
            const mkdirresult = await exec(`mkdir ${tempDir}`)
            await exec(`git clone -s ${directories.output}${eleventyConfig.getFilter("slugify")(repoName)}.git ${tempDirRepoPath}`)
            Promise.all(repoConfig.branchesToPull.map(async (branch) => {
              await exec(`(cd ${tempDirRepoPath} && git checkout ${branch})`)
              return Promise.all(repoConfig.artifactSteps.map(async (artifactStep) => {
                // Run the command for each step in each branch
                await exec(`(cd ${tempDirRepoPath} && ${artifactStep.command})`)
                // Copy the specified folders from the "from" to the "to" dir
                return exec(`cp -r ${tempDirRepoPath}/${artifactStep.copyFrom} ${directories.output}${eleventyConfig.getFilter("slugify")(repoName)}/branches/${eleventyConfig.getFilter("slugify")(branch)}/${artifactStep.copyTo}`)
              }))
            })).then(async () => {
              // delete the temp dirs
              await exec(`rm -r ${tempDir}`)
            })
          }
schemas/ReposConfiguration.json:11
Before
11
After
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
        "artifactSteps": {
          "items": {
            "additionalProperties": false,
            "properties": {
              "command": {
                "type": "string"
              },
              "copyFrom": {
                "type": "string"
              },
              "copyTo": {
                "type": "string"
              }
            },
            "required": [
              "command",
              "copyFrom",
              "copyTo"
            ],
            "type": "object"
          },
          "type": "array"
        },
schemas/ReposConfiguration.json:59
Before
59
After
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
        "artifactSteps": {
          "items": {
            "additionalProperties": false,
            "properties": {
              "command": {
                "type": "string"
              },
              "copyFrom": {
                "type": "string"
              },
              "copyTo": {
                "type": "string"
              }
            },
            "required": [
              "command",
              "copyFrom",
              "copyTo"
            ],
            "type": "object"
          },
          "type": "array"
        },
src/configTypes.ts:71
Before
71
  }
After
71 72 73 74 75 76
  },
  artifactSteps?: {
      command: string,
      copyFrom: string,
      copyTo: string,
  }[]
src/configTypes.ts:153
Before
153
  }
After
153 154 155 156 157 158
  },
  artifactSteps?: {
      command: string,
      copyFrom: string,
      copyTo: string,
  }[]