1
0

build.yml 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. name: "Build BetterYTM"
  2. on:
  3. workflow_dispatch:
  4. pull_request:
  5. branches: [main]
  6. push:
  7. branches: [main]
  8. jobs:
  9. build:
  10. name: Build
  11. runs-on: ubuntu-latest
  12. timeout-minutes: 8
  13. strategy:
  14. matrix:
  15. node-version: [22.x]
  16. env:
  17. CI: "true"
  18. STORE_PATH: ""
  19. PNPM_VERSION: 9
  20. RETENTION_DAYS: 2
  21. steps:
  22. - name: Check out the repository
  23. uses: actions/checkout@v4
  24. - name: Set up Node.js v${{ matrix.node-version }}
  25. uses: actions/setup-node@v4
  26. with:
  27. node-version: ${{ matrix.node-version }}
  28. - name: Set up pnpm
  29. uses: pnpm/action-setup@v4
  30. with:
  31. version: ${{ env.PNPM_VERSION }}
  32. run_install: false
  33. - name: Get pnpm store directory
  34. shell: bash
  35. run: |
  36. echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
  37. - name: Setup pnpm cache
  38. uses: actions/cache@v4
  39. with:
  40. path: ${{ env.STORE_PATH }}
  41. key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
  42. restore-keys: |
  43. ${{ runner.os }}-pnpm-store-
  44. - name: Install dependencies
  45. run: pnpm install
  46. - name: Build all for production
  47. run: pnpm run build-prod
  48. - name: Upload artifacts
  49. uses: actions/upload-artifact@v4
  50. with:
  51. name: dist
  52. path: dist
  53. retention-days: ${{ env.RETENTION_DAYS }}