ftp-schedule.yml 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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@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. sed -i "s#VITE_DROP_CONSOLE\s*=.*#VITE_DROP_CONSOLE = true#g" ./.env.production
  19. cat ./.env.production
  20. - name: use Node.js 15
  21. uses: actions/setup-node@v2.1.2
  22. with:
  23. node-version: '15.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@v2
  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@2.0.0
  40. env:
  41. FTP_SERVER: ${{ secrets.FTP_SERVER }}
  42. FTP_USERNAME: ${{ secrets.FTP_USERNAME }}
  43. FTP_PASSWORD: ${{ secrets.FTP_PASSWORD }}
  44. METHOD: sftp
  45. PORT: ${{ secrets.FTP_PORT }}
  46. LOCAL_DIR: dist
  47. REMOTE_DIR: /srv/www/vben-admin
  48. ARGS: --delete --verbose --parallel=80