Skip to content

Commit

Permalink
Merge pull request #5 from CS3219-AY2425S1/fe-gh-actions-patch
Browse files Browse the repository at this point in the history
Update nextjs.yml
  • Loading branch information
tingkai-mai authored Sep 17, 2024
2 parents be4e075 + 1a721ea commit 65eed0a
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions .github/workflows/nextjs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,21 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "yarn" # or "npm" depending on what you use

- name: Detect package manager
id: detect-package-manager
run: |
if [ -f "${{ github.workspace }}/frontend/yarn.lock" ]; then
if [ -f "frontend/yarn.lock" ]; then
echo "manager=yarn" >> $GITHUB_OUTPUT
echo "command=install" >> $GITHUB_OUTPUT
echo "runner=yarn" >> $GITHUB_OUTPUT
exit 0
elif [ -f "${{ github.workspace }}/frontend/package.json" ]; then
elif [ -f "frontend/package-lock.json" ]; then
echo "manager=npm" >> $GITHUB_OUTPUT
echo "command=ci" >> $GITHUB_OUTPUT
echo "runner=npx --no-install" >> $GITHUB_OUTPUT
Expand All @@ -50,17 +56,6 @@ jobs:
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@v5
with:
static_site_generator: next

- name: Restore cache
uses: actions/cache@v4
with:
Expand Down

0 comments on commit 65eed0a

Please sign in to comment.