From 327ae305ecfde516bd228cb3ac675ac605a460fd Mon Sep 17 00:00:00 2001 From: praliptarajoo Date: Wed, 10 Jan 2024 17:35:00 +0530 Subject: [PATCH] YML updated to push entire build directory to gh-pages --- .github/workflows/ci.yml | 14 ++++---------- next.config.js | 2 +- package.json | 4 ++-- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5961e312..fa0e59b6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,20 +36,14 @@ jobs: git config --local user.email "github-actions@github.com" git config --local user.name "GitHub Actions" - - name: 'Resolve merge conflicts if any' - run: | - git checkout main - git fetch origin - git reset --hard origin/main - - name: 'Copy build artifacts to gh-pages branch' run: | mkdir /tmp/temp-directory - cp -r .next/* /tmp/temp-directory/ + cp -r build/* /tmp/temp-directory/ git checkout gh-pages - git rm -rf . - cp -r /tmp/temp-directory/ . - git add temp-directory/ + rm -rf * + cp -r /tmp/temp-directory/* . + git add . git commit -m "Copy build artifacts from main to gh-pages branch" - name: Push to gh-pages diff --git a/next.config.js b/next.config.js index 56fe71a9..6aee335f 100644 --- a/next.config.js +++ b/next.config.js @@ -18,7 +18,7 @@ module.exports = (phase, { defaultConfig }) => { unoptimized: true, }, output: "export", - distDir: "docs" + distDir: "build" }; } diff --git a/package.json b/package.json index 1d261e85..58bd4245 100644 --- a/package.json +++ b/package.json @@ -4,10 +4,10 @@ "private": true, "scripts": { "dev": "next dev", - "build": "next build && touch ./docs/.nojekyll", + "build": "next build && touch ./build/.nojekyll", "start": "next start", "lint": "next lint", - "start:build": "serve ./docs", + "start:build": "serve ./build", "prepare": "husky install", "check-types": "tsc --pretty --noEmit", "check-format": "npx prettier --check .",