From fa4d9b3a2242661d4032b1d07991c59fb6f719cb Mon Sep 17 00:00:00 2001 From: Helen Chong <119173961+helenclx@users.noreply.github.com> Date: Thu, 30 May 2024 13:53:44 +0800 Subject: [PATCH] Deploy to GitHub Pages --- .github/workflows/gh-pages.yml | 46 ++++++++++++++++++++++++++++++++++ package.json | 3 ++- 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/gh-pages.yml diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml new file mode 100644 index 00000000..80fbe550 --- /dev/null +++ b/.github/workflows/gh-pages.yml @@ -0,0 +1,46 @@ +# Mini-tutorial for deploying Eleventyproject to GitHub Pages: +# https://www.11ty.dev/docs/deployment/#deploy-an-eleventy-project-to-github-pages + +name: Deploy to GitHub Pages + +on: + push: + branches: + - main + pull_request: + +jobs: + deploy: + runs-on: ubuntu-latest + permissions: + contents: write + concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + steps: + - uses: actions/checkout@v4 + + # Set up bun + - name: Use Bun + uses: oven-sh/setup-bun@v1 + with: + bun-version: latest + - name: Install deps and build + run: | + bun i + bun run build + + - name: Persist Eleventy .cache + uses: actions/cache@v4 + with: + path: ./.cache + key: ${{ runner.os }}-eleventy-fetch-cache + + - run: bun install + - run: bun run build-ghpages + + - name: Deploy + uses: peaceiris/actions-gh-pages@v4 + if: github.ref == 'refs/heads/main' + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./_site \ No newline at end of file diff --git a/package.json b/package.json index 54f0d45f..e7fbd3c0 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,8 @@ "name": "neocities-leilukin", "scripts": { "start": "bunx @11ty/eleventy --serve --quiet", - "build": "bunx @11ty/eleventy" + "build": "bunx @11ty/eleventy", + "build-ghpages": "bunx @11ty/eleventy" }, "devDependencies": { "@types/bun": "latest"