Skip to content

Commit

Permalink
Update nextjs.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Flopsky authored Dec 31, 2023
1 parent 9c0aa89 commit 6130439
Showing 1 changed file with 10 additions and 39 deletions.
49 changes: 10 additions & 39 deletions .github/workflows/nextjs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,47 +32,19 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Detect package manager
id: detect-package-manager
run: |
if [ -f "${{ github.workspace }}/yarn.lock" ]; then
echo "manager=yarn" >> $GITHUB_OUTPUT
echo "command=install" >> $GITHUB_OUTPUT
echo "runner=yarn" >> $GITHUB_OUTPUT
exit 0
elif [ -f "${{ github.workspace }}/package.json" ]; then
echo "manager=npm" >> $GITHUB_OUTPUT
echo "command=ci" >> $GITHUB_OUTPUT
echo "runner=npx --no-install" >> $GITHUB_OUTPUT
exit 0
else
echo "Unable to determine package manager"
exit 1
fi

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20"
cache: ${{ steps.detect-package-manager.outputs.manager }}
- name: Setup Pages
uses: actions/configure-pages@v4
with:
static_site_generator: next
- name: Restore cache
uses: actions/cache@v3
with:
path: |
.next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-
- name: Install dependencies
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
- name: Build and export with Next.js
run: |
npm install
npm run next build
npm run next export
node-version: "14" # adjust the version if needed
cache: "npm"

- name: Install Dependencies
run: npm install

- name: Build with Next.js
run: npm run build && npm run export

- name: Upload artifact
uses: actions/upload-artifact@v2
with:
Expand All @@ -87,5 +59,4 @@ jobs:
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

0 comments on commit 6130439

Please sign in to comment.