Skip to content

Commit

Permalink
Merge branch 'main' into feat/60/remove-unused-env-vars
Browse files Browse the repository at this point in the history
  • Loading branch information
LobeTia authored Sep 30, 2024
2 parents da86686 + 7917a3e commit d4f3e63
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 3 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/check-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Check build

on:
pull_request:
types: [opened, reopened, synchronize]

workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- 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" >&2
exit 1
fi
- name: Setup Node
uses: actions/setup-node@v3
with:
# NVM Codename for Node 20 LTS
node-version: "lts/iron"
cache: ${{ steps.detect-package-manager.outputs.manager }}
- 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') }}-${{ 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') }}-
- name: Install dependencies
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
- name: Check build
run: ${{ steps.detect-package-manager.outputs.manager }} run build
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Check NextJs build
name: Check lint

on:
pull_request:
Expand All @@ -12,6 +12,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Detect package manager
id: detect-package-manager
run: |
Expand Down Expand Up @@ -47,5 +49,5 @@ jobs:
${{ 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 with Next.js
run: ${{ steps.detect-package-manager.outputs.manager }} run build
- name: Check lint
run: ${{ steps.detect-package-manager.outputs.manager }} run lint

0 comments on commit d4f3e63

Please sign in to comment.