Skip to content

Commit

Permalink
fix nextjs.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
HotsykVictor committed Sep 21, 2023
1 parent 51fe6e5 commit ca515c9
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 12 deletions.
62 changes: 50 additions & 12 deletions .github/workflows/nextjs.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Sample workflow for building and deploying a Next.js site to GitHub Pages
#
# To get started with Next.js see: https://nextjs.org/docs/getting-started
#
#
name: Deploy Next.js site to Pages

Expand All @@ -25,31 +25,69 @@ concurrency:
cancel-in-progress: false

jobs:
# Build job
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./landing
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Bun
uses: actions/checkout@v3
- 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 }}/bun.lockb" ]; then
echo "manager=bun" >> $GITHUB_OUTPUT
echo "command=install" >> $GITHUB_OUTPUT
echo "runner=bun" >> $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: Set up Bun
uses: oven-sh/setup-bun@v1
- name: Setup Pages
uses: actions/configure-pages@v3
with:
bun-version: latest

# Automatically inject basePath in your Next.js configuration file and disable
# server side image optimization (https://nextjs.org/docs/api-reference/next/image#unoptimized).
#
# You may remove this line if you want to manage the configuration yourself.
static_site_generator: next
- name: Restore cache
uses: actions/cache@v3
with:
path: |
.next/cache
# Generate a new cache whenever packages or source files change.
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock', '**/bun.lockb') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
# If source files changed but packages didn't, rebuild from a prior cache.
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock', '**/bun.lockb') }}-
- name: Install dependencies
run: bun i

- name: Build
run: bun run build

run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
- name: Build with Next.js
run: ${{ steps.detect-package-manager.outputs.runner }} next build
- name: Static HTML export with Next.js
run: ${{ steps.detect-package-manager.outputs.runner }} next export
- name: Upload artifact
uses: actions/upload-artifact@v2
uses: actions/upload-pages-artifact@v2
with:
path: ./out

# Deployment job
deploy:
environment:
name: github-pages
Expand Down
Binary file modified api/bun.lockb
Binary file not shown.

0 comments on commit ca515c9

Please sign in to comment.