ftp-schedule.yml 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. name: schedule-push-to-ftp
  2. # Timed deployment project
  3. on:
  4. push:
  5. schedule:
  6. - cron: '0 20 * * *'
  7. jobs:
  8. schedule-push-to-ftp:
  9. runs-on: ubuntu-latest
  10. steps:
  11. - name: Checkout
  12. uses: actions/checkout@v3
  13. - name: Sed Config Base
  14. shell: bash
  15. run: |
  16. sed -i 's#VITE_PUBLIC_PATH\s*=.*#VITE_PUBLIC_PATH = /next/#g' ./.env.production
  17. sed -i "s#VITE_BUILD_COMPRESS\s*=.*#VITE_BUILD_COMPRESS = 'gzip'#g" ./.env.production
  18. sed -i "s#VITE_DROP_CONSOLE\s*=.*#VITE_DROP_CONSOLE = true#g" ./.env.production
  19. cat ./.env.production
  20. - name: use Node.js 16
  21. uses: actions/setup-node@v3
  22. with:
  23. node-version: 16
  24. - name: Get yarn cache
  25. id: yarn-cache
  26. run: echo "::set-output name=dir::$(yarn cache dir)"
  27. - name: Cache dependencies
  28. uses: actions/cache@v3
  29. with:
  30. path: ${{ steps.yarn-cache.outputs.dir }}
  31. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  32. restore-keys: |
  33. ${{ runner.os }}-yarn-
  34. - name: Build
  35. run: |
  36. yarn install
  37. yarn run build
  38. - name: Deploy
  39. uses: SamKirkland/FTP-Deploy-Action@4.3.2
  40. with:
  41. server: ${{ secrets.FTP_SERVER }}
  42. username: ${{ secrets.FTP_USERNAME }}
  43. password: ${{ secrets.FTP_PASSWORD }}
  44. protocol: ftps
  45. port: ${{ secrets.FTP_PORT }}
  46. local-dir: ./dist/
  47. server-dir: ./srv/www/vben-admin/
  48. timeout: 60000
  49. # ARGS: --delete --verbose --parallel=80