From 86049e65f2f6e7bea4760435d7c15efc151d5f27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Kn=C3=B6rzer?= <33221434+davidknoerzer@users.noreply.github.com> Date: Wed, 7 Feb 2024 10:33:46 +0100 Subject: [PATCH] updated ci/cd --- .github/workflows/nextjs.yml | 17 +++++++++-------- next.config.mjs | 30 ++++++++++++++++++++++++++---- public/.nojekyll | 0 3 files changed, 35 insertions(+), 12 deletions(-) create mode 100644 public/.nojekyll diff --git a/.github/workflows/nextjs.yml b/.github/workflows/nextjs.yml index fb8f21c..2c6089d 100644 --- a/.github/workflows/nextjs.yml +++ b/.github/workflows/nextjs.yml @@ -7,7 +7,7 @@ name: Deploy Next.js site to Pages on: # Runs on pushes targeting the default branch push: - branches: [$default-branch] + branches: ["main"] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -31,6 +31,7 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + - name: Detect package manager id: detect-package-manager run: | @@ -48,19 +49,16 @@ jobs: echo "Unable to determine package manager" exit 1 fi + - name: Setup Node uses: actions/setup-node@v4 with: - node-version: "20" + node-version: "lts/*" cache: ${{ steps.detect-package-manager.outputs.manager }} + - name: Setup Pages uses: actions/configure-pages@v4 - with: - # Automatically inject basePath in your Next.js configuration file and disable - # server side image optimization (https://nextjs.org/docs/api-reference/next/image#unoptimized). - # - # You may remove this line if you want to manage the configuration yourself. - static_site_generator: next + - name: Restore cache uses: actions/cache@v4 with: @@ -71,10 +69,13 @@ jobs: # If source files changed but packages didn't, rebuild from a prior cache. restore-keys: | ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}- + - name: Install dependencies run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }} + - name: Build with Next.js run: ${{ steps.detect-package-manager.outputs.runner }} next build + - name: Upload artifact uses: actions/upload-pages-artifact@v3 with: diff --git a/next.config.mjs b/next.config.mjs index debd939..8307c6b 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -1,6 +1,28 @@ /** @type {import('next').NextConfig} */ const nextConfig = { - output: 'export', -}; - -export default nextConfig; + /** + * Enable static exports for the App Router. + * + * @see https://nextjs.org/docs/app/building-your-application/deploying/static-exports + */ + output: "export", + + /** + * Set base path. This is the slug of your GitHub repository. + * + * @see https://nextjs.org/docs/app/api-reference/next-config-js/basePath + */ + basePath: "/davidknoerzer.github.io", + + /** + * Disable server-based image optimization. Next.js does not support + * dynamic features with static exports. + * + * @see https://nextjs.org/docs/app/api-reference/components/image#unoptimized + */ + images: { + unoptimized: true, + }, + }; + + export default nextConfig; \ No newline at end of file diff --git a/public/.nojekyll b/public/.nojekyll new file mode 100644 index 0000000..e69de29