From bb2c2389c69271202e37344f1bdc416e8463dc93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=84=EC=A7=84=ED=98=B8?= Date: Tue, 10 Sep 2024 20:32:42 +0900 Subject: [PATCH] feat: add index page builder --- .github/workflows/deploy.yml | 6 +++- .scripts/index-page-builder.js | 50 ++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 .scripts/index-page-builder.js diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index ce955dac..7e96ffb5 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -53,9 +53,13 @@ jobs: # done pnpm build + - name: Create dynamic index.html + run: | + echo "Generating dynamic index.html" + node .scripts/index-page-builder.js + - name: Deploy uses: peaceiris/actions-gh-pages@v4 with: personal_token: ${{ secrets.GH_ACTIONS_TOKEN }} publish_dir: ./build - diff --git a/.scripts/index-page-builder.js b/.scripts/index-page-builder.js new file mode 100644 index 00000000..abf1f4a3 --- /dev/null +++ b/.scripts/index-page-builder.js @@ -0,0 +1,50 @@ +const fs = require("fs"); +const path = require("path"); + +// 'build' 폴더를 기준으로 탐색 시작 +const baseDir = "../build"; + +// HTML 템플릿을 시작합니다. +let htmlContent = ` + + + + + + Project Index + + +

Projects

+ + + +`; + +// 생성된 HTML을 'build/index.html'에 작성 +fs.writeFileSync(path.join(baseDir, "index.html"), htmlContent); + +console.log("index.html created successfully.");