web.yml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. name: Build Web
  2. on:
  3. push:
  4. branches:
  5. - master
  6. paths:
  7. - '**/modules/web/**'
  8. pull_request:
  9. paths:
  10. - '**/modules/web/**'
  11. workflow_dispatch:
  12. env:
  13. UPSTREAM_REPOSITORY: gedoor/legado
  14. jobs:
  15. build:
  16. runs-on: ubuntu-latest
  17. steps:
  18. - name: Checkout
  19. uses: actions/checkout@v4
  20. - name: Install Node.js
  21. uses: actions/setup-node@v4
  22. with:
  23. node-version: 16
  24. - uses: pnpm/action-setup@v3
  25. name: Install pnpm
  26. id: pnpm-install
  27. with:
  28. version: 8
  29. run_install: false
  30. - name: Get pnpm store directory
  31. id: pnpm-cache
  32. shell: bash
  33. run: |
  34. echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
  35. - uses: actions/cache@v4
  36. name: Setup pnpm cache
  37. with:
  38. path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
  39. key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/web/package.json') }}
  40. restore-keys: |
  41. ${{ runner.os }}-pnpm-store-
  42. - name: Build and move files
  43. working-directory: modules/web
  44. run: |
  45. pnpm i
  46. pnpm build
  47. version="v$(date -d "8 hour" -u +3.%y.%m%d%H)"
  48. echo "APP_VER=$version" >> $GITHUB_ENV
  49. - name: push changes
  50. if: ${{ github.event_name != 'pull_request' && github.repository == env.UPSTREAM_REPOSITORY }}
  51. uses: stefanzweifel/git-auto-commit-action@v5.0.1
  52. with:
  53. commit_message: Bump web ${{ env.APP_VER}}
  54. file_pattern: app/src/main/assets/web/vue/