ftp-schedule.yml 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. name: schedule-push-to-ftp
  2. # Timed deployment project
  3. on:
  4. push:
  5. schedule:
  6. - cron: '0 15 * * *'
  7. jobs:
  8. push-to-ftp:
  9. runs-on: ubuntu-latest
  10. steps:
  11. - name: Checkout
  12. uses: actions/checkout@v2
  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. cat ./.env.production
  19. - name: use Node.js 14
  20. uses: actions/setup-node@v2.1.2
  21. with:
  22. node-version: '14.x'
  23. - name: Get yarn cache
  24. id: yarn-cache
  25. run: echo "::set-output name=dir::$(yarn cache dir)"
  26. - name: Cache dependencies
  27. uses: actions/cache@v2
  28. with:
  29. path: ${{ steps.yarn-cache.outputs.dir }}
  30. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  31. restore-keys: |
  32. ${{ runner.os }}-yarn-
  33. - name: Build
  34. run: |
  35. yarn install
  36. yarn run build
  37. - name: Deploy
  38. uses: SamKirkland/FTP-Deploy-Action@2.0.0
  39. env:
  40. FTP_SERVER: ${{ secrets.FTP_SERVER }}
  41. FTP_USERNAME: ${{ secrets.FTP_USERNAME }}
  42. FTP_PASSWORD: ${{ secrets.FTP_PASSWORD }}
  43. METHOD: sftp
  44. PORT: ${{ secrets.FTP_PORT }}
  45. LOCAL_DIR: dist
  46. REMOTE_DIR: /srv/www/vben-admin
  47. ARGS: --delete --verbose --parallel=80