main.yml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. name: CI
  2. on:
  3. push:
  4. branches: [ master ]
  5. pull_request:
  6. branches: [ master ]
  7. jobs:
  8. build:
  9. strategy:
  10. matrix:
  11. node-version: [12.x]
  12. runs-on: ubuntu-latest
  13. steps:
  14. - name: Check out branch
  15. uses: actions/checkout@v4
  16. - name: Get npm cache directory
  17. id: npm-cache-dir
  18. run: |
  19. echo "::set-output name=dir::$(npm config get cache)"
  20. - uses: actions/cache@v2
  21. id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true'
  22. with:
  23. path: ${{ steps.npm-cache-dir.outputs.dir }}
  24. key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
  25. restore-keys: |
  26. ${{ runner.os }}-node-
  27. - name: Get yarn cache directory path
  28. id: yarn-cache-dir-path
  29. run: echo "::set-output name=dir::$(yarn cache dir)"
  30. - uses: actions/cache@v2
  31. id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
  32. with:
  33. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  34. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  35. restore-keys: |
  36. ${{ runner.os }}-yarn-
  37. - name: Install Dependencies
  38. if: steps.npm-cache.outputs.cache-hit != 'true'
  39. run: npm install
  40. - name: Install Dependencies
  41. if: steps.yarn-cache.outputs.cache-hit != 'true'
  42. run: yarn --frozen-lockfile
  43. - name: Build
  44. run: |
  45. yarn build