Skip to content

Commit

Permalink
updated ci/cd
Browse files Browse the repository at this point in the history
  • Loading branch information
davidknoerzer committed Feb 7, 2024
1 parent 5a01fb5 commit 86049e6
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 12 deletions.
17 changes: 9 additions & 8 deletions .github/workflows/nextjs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -31,6 +31,7 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Detect package manager
id: detect-package-manager
run: |
Expand All @@ -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:
Expand All @@ -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:
Expand Down
30 changes: 26 additions & 4 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -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;
Empty file added public/.nojekyll
Empty file.

0 comments on commit 86049e6

Please sign in to comment.