🔧 Add post-process for CNAME

This commit is contained in:
Anand Chowdhary
2020-08-10 13:34:01 +05:30
parent 6c6f5a2b59
commit ef55ba875a
2 changed files with 19 additions and 0 deletions
+2
View File
@@ -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
+17
View File
@@ -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();