ftp-schedule.yml 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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.x'
  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. node-version: '16.x'
  42. env:
  43. FTP_SERVER: ${{ secrets.FTP_SERVER }}
  44. FTP_USERNAME: ${{ secrets.FTP_USERNAME }}
  45. FTP_PASSWORD: ${{ secrets.FTP_PASSWORD }}
  46. METHOD: sftp
  47. PORT: ${{ secrets.FTP_PORT }}
  48. LOCAL_DIR: dist
  49. REMOTE_DIR: /srv/www/vben-admin
  50. ARGS: --delete --verbose --parallel=80