Add an optional "artifactSteps" category

005a065fd24cdf90fbf1e4d44df8672e9a929eba

Tucker McKnight <tucker@pangolin.lan> | Sun Oct 12 2025

Add an optional "artifactSteps" category

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.
main.ts:82
Before
81
82
83




















84
85
            await exec(`(cd ${eleventyConfig.dir.output + reposPath + "/"} && git clone ${originalLocation} ${gitRepoName} --bare)`)
            await exec(`(cd ${eleventyConfig.dir.output + reposPath + "/" + gitRepoName} && git update-server-info)`)
          }
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
        }
      }
    }
After
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
            await exec(`(cd ${eleventyConfig.dir.output + reposPath + "/"} && git clone ${originalLocation} ${gitRepoName} --bare)`)
            await exec(`(cd ${eleventyConfig.dir.output + reposPath + "/" + gitRepoName} && git update-server-info)`)
          }
          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
10
11
12























13
14
          "description": "Must be set to `\"darcs\"`.",
          "type": "string"
        },
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
        "branches": {
          "additionalProperties": {
            "additionalProperties": false,
After
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
          "description": "Must be set to `\"darcs\"`.",
          "type": "string"
        },
        "artifactSteps": {
          "items": {
            "additionalProperties": false,
            "properties": {
              "command": {
                "type": "string"
              },
              "copyFrom": {
                "type": "string"
              },
              "copyTo": {
                "type": "string"
              }
            },
            "required": [
              "command",
              "copyFrom",
              "copyTo"
            ],
            "type": "object"
          },
          "type": "array"
        },
        "branches": {
          "additionalProperties": {
            "additionalProperties": false,
schemas/ReposConfiguration.json:59
Before
58
59
60























61
62
          "const": "git",
          "type": "string"
        },
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
        "branchesToPull": {
          "items": {
            "type": "string"
After
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
          "const": "git",
          "type": "string"
        },
        "artifactSteps": {
          "items": {
            "additionalProperties": false,
            "properties": {
              "command": {
                "type": "string"
              },
              "copyFrom": {
                "type": "string"
              },
              "copyTo": {
                "type": "string"
              }
            },
            "required": [
              "command",
              "copyFrom",
              "copyTo"
            ],
            "type": "object"
          },
          "type": "array"
        },
        "branchesToPull": {
          "items": {
            "type": "string"
src/configTypes.ts:71
Before
70
71
72
73




74
75
  branchesToPull: Array<string>,
  languageExtensions?: {
    [fileExtension: string]: string
  }
⁣
⁣
⁣
⁣
}

⁣
/**
After
70
71
72
73
74
75
76
77
78
79
80
  branchesToPull: Array<string>,
  languageExtensions?: {
    [fileExtension: string]: string
  },
  artifactSteps?: {
      command: string,
      copyFrom: string,
      copyTo: string,
  }[]
}

/**
src/configTypes.ts:153
Before
152
153
154
155




  */
  languageExtensions?: {
    [fileExtension: string]: string
  }
⁣
⁣
⁣
⁣
⁣
}
After
152
153
154
155
156
157
158
159
160
  */
  languageExtensions?: {
    [fileExtension: string]: string
  },
  artifactSteps?: {
      command: string,
      copyFrom: string,
      copyTo: string,
  }[]
}