From 137a2a083c3614b451a47ee19b9c4c8dd696dfc3 Mon Sep 17 00:00:00 2001 From: Tumppi066 <83072683+Tumppi066@users.noreply.github.com> Date: Tue, 31 Dec 2024 19:50:20 +0200 Subject: [PATCH] Initial commit with github pages. --- .github/workflows/deploy.yml | 34 ++++++++++++++++++++++++++++++++++ .gitignore | 3 +++ frontend/next.config.mjs | 10 +++++++--- frontend/package.json | 1 + 4 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..cdbfb84 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,34 @@ +name: Deploy Next.js App to GitHub Pages + +on: + push: + branches: + - main + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: 22 + + - name: Install dependencies + run: npm install + + - name: Build the app + run: npm run build + + - name: Export the app + run: npm run export + + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./out # The directory where the static files are generated \ No newline at end of file diff --git a/.gitignore b/.gitignore index c6bba59..e3a4901 100644 --- a/.gitignore +++ b/.gitignore @@ -128,3 +128,6 @@ dist .yarn/build-state.yml .yarn/install-state.gz .pnp.* + +# vscode +.vscode \ No newline at end of file diff --git a/frontend/next.config.mjs b/frontend/next.config.mjs index 4678774..dffe57d 100644 --- a/frontend/next.config.mjs +++ b/frontend/next.config.mjs @@ -1,4 +1,8 @@ /** @type {import('next').NextConfig} */ -const nextConfig = {}; - -export default nextConfig; +const nextConfig = { + output: 'export', + basePath: process.env.NODE_ENV === 'production' ? '/frontend' : '', + assetPrefix: process.env.NODE_ENV === 'production' ? '/frontend/' : '', +}; + +export default nextConfig; \ No newline at end of file diff --git a/frontend/package.json b/frontend/package.json index d6f485b..cfd2fe3 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -5,6 +5,7 @@ "scripts": { "dev": "next dev", "build": "next build", + "export": "next export", "start": "next start > nul 2>&1", "lint": "next lint" },