diff --git a/.github/workflows/site.yml b/.github/workflows/site.yml index 28fca6cb..6078bcae 100644 --- a/.github/workflows/site.yml +++ b/.github/workflows/site.yml @@ -19,6 +19,8 @@ jobs: run: cd site && npm ci - name: Build site run: cd site && npm run export + - name: Post process site + run: npx ts-node site/post-process.ts env: NODE_ENV: "production" - uses: maxheld83/ghpages@v0.2.1 diff --git a/site/post-process.ts b/site/post-process.ts new file mode 100644 index 00000000..ead31bb6 --- /dev/null +++ b/site/post-process.ts @@ -0,0 +1,17 @@ +import fs from "fs"; +import { join } from "path"; + +export const postProcess = () => { + const configFile = fs.readFileSync(join(".", ".statusrc.yml")).toString(); + const cnameLine = configFile + .split("\n") + .find((line) => line.includes("cname:")); + if (cnameLine) { + fs.writeFileSync( + join(".", "site", "__export__", "CNAME"), + cnameLine.split("cname:")[1].trim() + ); + } +}; + +postProcess();