Skip to content

Commit

Permalink
Merge pull request #53 from Schrodinger-Hat/feat/31/github-building-a…
Browse files Browse the repository at this point in the history
…ction

feat: Setup GH actions for buld check
  • Loading branch information
LobeTia authored Apr 13, 2024
2 parents 62cb656 + 8dde866 commit 64a2355
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 18 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/pt-nextjs-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Check NextJs build

on:
pull_request:
types: [opened, reopened]

workflow_dispatch:

env:

jobs:
build:
runs-on: ubuntu-latest
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" >&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: Build with Next.js
run: ${{ steps.detect-package-manager.outputs.manager }} run build
18 changes: 0 additions & 18 deletions .github/workflows/workflows/commit-lint.yml

This file was deleted.

0 comments on commit 64a2355

Please sign in to comment.