This commit is contained in:
2024-06-25 14:51:21 +02:00
parent 4fc31cc313
commit 288f07c65a
+44 -51
View File
@@ -26,11 +26,6 @@ jobs:
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: "22" node-version: "22"
# - name: Install pnpm
# run: npm install -g pnpm
- name: Cache Dependencies - name: Cache Dependencies
uses: actions/cache@v4 uses: actions/cache@v4
@@ -40,57 +35,55 @@ jobs:
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }} key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: | restore-keys: |
${{ runner.os }}-node-modules- ${{ 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 - name: Upload Artifact
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: nextjs-build name: nextjs-build
path: .next/ 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 - name: Archive artifact
# uses: peaceiris/actions-gh-pages@v3 run: tar czf nextjs-build.tar.gz.next/
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }} - name: Upload archived artifact
# publish_dir: ./next/.next uses: actions/upload-artifact@v3
# publish_branch: gh-pages # Change this to master if using the master branch for GitHub Pages with:
# allow_empty_commit: false name: nextjs-archive
# keep_files: false path: nextjs-build.tar.gz
# force_orphan: false
# enable_jekyll: false deploy:
# disable_nojekyll: false needs: build
# exclude_assets: .github 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