action.yml 995 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. name: 'Setup Node'
  2. description: 'Setup node and pnpm'
  3. runs:
  4. using: 'composite'
  5. steps:
  6. - name: Install pnpm
  7. uses: pnpm/action-setup@v4
  8. - name: Install Node.js
  9. uses: actions/setup-node@v4
  10. with:
  11. node-version-file: .node-version
  12. cache: 'pnpm'
  13. - name: Get pnpm store directory
  14. shell: bash
  15. run: |
  16. echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
  17. - uses: actions/cache@v4
  18. name: Setup pnpm cache
  19. if: ${{ github.ref_name == 'main' }}
  20. with:
  21. path: ${{ env.STORE_PATH }}
  22. key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
  23. restore-keys: |
  24. ${{ runner.os }}-pnpm-store-
  25. - uses: actions/cache/restore@v4
  26. if: ${{ github.ref_name != 'main' }}
  27. with:
  28. path: ${{ env.STORE_PATH }}
  29. key: |
  30. ${{ runner.os }}-pnpm-store-
  31. - name: Install dependencies
  32. shell: bash
  33. run: pnpm install --frozen-lockfile