action.yml 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. name: 'Setup Javascript'
  2. description: 'Setup a Javascript environment ready to run the Mastodon code'
  3. inputs:
  4. onlyProduction:
  5. description: Only install production dependencies
  6. default: 'false'
  7. runs:
  8. using: 'composite'
  9. steps:
  10. - name: Set up Node.js
  11. uses: actions/setup-node@v4
  12. with:
  13. node-version-file: '.nvmrc'
  14. # The following is needed because we can not use `cache: true` for `setup-node`, as it does not support Corepack yet and mess up with the cache location if ran after Node is installed
  15. - name: Enable corepack
  16. shell: bash
  17. run: corepack enable
  18. - name: Get yarn cache directory path
  19. id: yarn-cache-dir-path
  20. shell: bash
  21. run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
  22. - uses: actions/cache@v4
  23. id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
  24. with:
  25. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  26. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  27. restore-keys: |
  28. ${{ runner.os }}-yarn-
  29. - name: Install all yarn packages
  30. shell: bash
  31. run: yarn install --immutable
  32. if: inputs.onlyProduction == 'false'
  33. - name: Install all production yarn packages
  34. shell: bash
  35. run: yarn workspaces focus --production
  36. if: inputs.onlyProduction != 'false'