Skip to content

Commit

Permalink
actions: cache-dependency-path added for varying managers
Browse files Browse the repository at this point in the history
  • Loading branch information
mahesh-naxa authored Sep 27, 2023
1 parent 44ff2a1 commit 89b9741
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .github/workflows/nextjs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,20 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Detect package manager
id: detect-package-manager
run: |
if [ -f "${{ github.workspace }}/frontend/yarn.lock" ]; then
echo "manager=yarn" >> $GITHUB_OUTPUT
echo "command=install" >> $GITHUB_OUTPUT
echo "runner=yarn" >> $GITHUB_OUTPUT
echo "path=frontend/yarn.lock" >> $GITHUB_OUTPUT
exit 0
elif [ -f "${{ github.workspace }}/frontend/package.json" ]; then
echo "manager=npm" >> $GITHUB_OUTPUT
echo "command=ci" >> $GITHUB_OUTPUT
echo "runner=npx --no-install" >> $GITHUB_OUTPUT
echo "path=frontend/package.json" >> $GITHUB_OUTPUT
exit 0
else
echo "Unable to determine package manager"
Expand All @@ -57,6 +58,7 @@ jobs:
with:
node-version: "16"
cache: ${{ steps.detect-package-manager.outputs.manager }}
cache-dependency-path: ${{ steps.detect-package-manager.outputs.path }}
- name: Setup Pages
uses: actions/configure-pages@v3
with:
Expand Down

0 comments on commit 89b9741

Please sign in to comment.