This commit is contained in:
2024-06-25 14:51:21 +02:00
parent 4fc31cc313
commit 288f07c65a
+30 -37
View File
@@ -27,11 +27,6 @@ jobs:
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
with: with:
@@ -50,47 +45,45 @@ jobs:
restore-keys: | restore-keys: |
${{ runner.os }}-nextjs-build-output- ${{ 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 - name: Archive artifact
run: tar czf nextjs-build.tar.gz.next/
- name: Upload archived artifact
uses: actions/upload-artifact@v3
with: with:
path: ./out name: nextjs-archive
path: nextjs-build.tar.gz
deploy: deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build needs: build
runs-on: ubuntu-latest
steps: 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 - name: Deploy to GitHub Pages
id: deployment uses: peaceiris/actions-gh-pages@v3
uses: actions/deploy-pages@v4 with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# deploy: publish_dir: ./ # Adjust this to the directory containing your built site
# needs: build publish_branch: gh-pages # Or 'master' if you prefer to serve from the master branch
# runs-on: ubuntu-latest allow_empty_commit: true
# steps: keep_files: false
# - name: Download Artifacts force_orphan: true
# uses: actions/download-artifact@v3 enable_jekyll: false
# with: disable_nojekyll: true
# 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