diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 4b3fb76..b7b3ffb 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -41,65 +41,20 @@ jobs: version: latest - name: Install dependencies run: pnpm install --no-frozen-lockfile - - name: Build - run: | - LOG_LEVEL=${{ env.LOG_LEVEL }} LOG_FORMAT=${{ env.LOG_FORMAT }} pnpm run build + - name: Run custom build script + run: ./build_and_handle_error.sh - name: Upload Pages Artifact uses: actions/upload-pages-artifact@v1 with: path: "./dist/" deploy: - needs: build + needs: build # Needs the 'build' job to complete before running runs-on: ubuntu-latest - environment: + environment: # This line should be indented under 'deploy' job name: github-pages - url: ${{ steps.deployment.outputs.page_url }} + url: ${{ steps.deployment.outputs.page_url }} # Indented under environment steps: - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v1 - -# Old job code: -# jobs: -# build: -# runs-on: ubuntu-latest -# steps: -# - name: Checkout your repository using git -# uses: actions/checkout@v3 -# # - name: Install, build, and upload your site -# # uses: withastro/action@v0 -# # with: -# # # path: . # The root location of your Astro project inside the repository. (optional) -# # node-version: 18 # The specific version of Node that should be used to build your site. Defaults to 16. (optional) -# # # package-manager: yarn # The Node package manager that should be used to install dependencies and build your site. Automatically detected based on your lockfile. (optional) -# -# # https://github.com/withastro/action/blob/v0/action.yml -# - name: Setup PNPM -# uses: pnpm/action-setup@v4 -# with: -# version: latest -# -# - name: Setup Node -# uses: actions/setup-node@v3 -# with: -# node-version: 18 -# cache: pnpm -# cache-dependency-path: "./pnpm-lock.yaml" -# -# - name: Install -# shell: "bash" -# run: | -# cd . -# pnpm install -# -# - name: Build -# shell: "bash" -# run: | -# cd . -# pnpm run build -# -# - name: Upload Pages Artifact -# uses: actions/upload-pages-artifact@v1 -# with: -# path: "./dist/" \ No newline at end of file + uses: actions/deploy-pages@v1 \ No newline at end of file diff --git a/build_and_handle_error.sh b/build_and_handle_error.sh new file mode 100644 index 0000000..c2dcdc9 --- /dev/null +++ b/build_and_handle_error.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +pnpm run build 2>&1 | tee build.log + +# Check for specific error message +if grep -q "Cannot read properties of undefined (reading 'info')" build.log; then + echo "astro-pagefind error encountered" + pnpm run postbuild +fi \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index b8a06cf..c862e34 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,7 +5,7 @@ "skipLibCheck": true, "target": "ESNext", "module": "ESNext", - "moduleResolution": "Node", + "moduleResolution": "NodeNext", "esModuleInterop": true, "resolveJsonModule": true, "paths": {