From 288f07c65a75abe642421f573deb4a6cb5d373d1 Mon Sep 17 00:00:00 2001 From: Leo dev Date: Tue, 25 Jun 2024 14:51:21 +0200 Subject: [PATCH] fix7 --- .github/workflows/nextjs.yml | 95 +++++++++++++++++------------------- 1 file changed, 44 insertions(+), 51 deletions(-) diff --git a/.github/workflows/nextjs.yml b/.github/workflows/nextjs.yml index 05f2fca..41cf3de 100644 --- a/.github/workflows/nextjs.yml +++ b/.github/workflows/nextjs.yml @@ -26,11 +26,6 @@ jobs: uses: actions/setup-node@v4 with: node-version: "22" - - # - name: Install pnpm - # run: npm install -g pnpm - - - name: Cache Dependencies uses: actions/cache@v4 @@ -40,57 +35,55 @@ jobs: key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }} restore-keys: | ${{ runner.os }}-node-modules- - - - name: Cache Build Output - uses: actions/cache@v4 - with: - path: | - .next/cache - key: ${{ runner.os }}-nextjs-build-output-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-nextjs-build-output- + - name: Cache Build Output + uses: actions/cache@v4 + with: + path: | + .next/cache + key: ${{ runner.os }}-nextjs-build-output-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-nextjs-build-output- + - name: Build + run: npm run build # Assuming you have a build script defined in your package.json + - name: Upload Artifact uses: actions/upload-artifact@v3 with: name: nextjs-build path: .next/ - - name: Upload artifact - uses: actions/upload-pages-artifact@v3 - with: - path: ./out - - deploy: - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - runs-on: ubuntu-latest - needs: build - steps: - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v4 - - # deploy: - # needs: build - # runs-on: ubuntu-latest - # steps: - # - name: Download Artifacts - # uses: actions/download-artifact@v3 - # with: - # name: nextjs-build - # path: . - # - name: Deploy to GitHub Pages - # uses: peaceiris/actions-gh-pages@v3 - # with: - # github_token: ${{ secrets.GITHUB_TOKEN }} - # publish_dir: ./next/.next - # publish_branch: gh-pages # Change this to master if using the master branch for GitHub Pages - # allow_empty_commit: false - # keep_files: false - # force_orphan: false - # enable_jekyll: false - # disable_nojekyll: false - # exclude_assets: .github + - name: Archive artifact + run: tar czf nextjs-build.tar.gz.next/ + + - name: Upload archived artifact + uses: actions/upload-artifact@v3 + with: + name: nextjs-archive + path: nextjs-build.tar.gz + + deploy: + needs: build + runs-on: ubuntu-latest + steps: + - name: Download Artifacts + uses: actions/download-artifact@v3 + with: + name: nextjs-build + path: . + + - name: Extract Artifact + run: tar xzf nextjs-build.tar.gz + + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./ # Adjust this to the directory containing your built site + publish_branch: gh-pages # Or 'master' if you prefer to serve from the master branch + allow_empty_commit: true + keep_files: false + force_orphan: true + enable_jekyll: false + disable_nojekyll: true