ftp-schedule.yml 1.6 KB
Newer Older
V
Vben 已提交
1 2 3 4 5 6
name: schedule-push-to-ftp

# Timed deployment project
on:
  push:
  schedule:
V
Vben 已提交
7
    - cron: '0 20 * * *'
V
Vben 已提交
8 9

jobs:
10
  schedule-push-to-ftp:
V
Vben 已提交
11 12 13 14 15 16 17 18 19 20
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Sed Config Base
        shell: bash
        run: |
          sed -i  's#VITE_PUBLIC_PATH\s*=.*#VITE_PUBLIC_PATH = /next/#g' ./.env.production
          sed -i  "s#VITE_BUILD_COMPRESS\s*=.*#VITE_BUILD_COMPRESS = 'gzip'#g" ./.env.production
21
          sed -i  "s#VITE_DROP_CONSOLE\s*=.*#VITE_DROP_CONSOLE = true#g" ./.env.production
V
Vben 已提交
22 23
          cat ./.env.production

V
vben 已提交
24
      - name: use Node.js 16
V
Vben 已提交
25 26
        uses: actions/setup-node@v2.1.2
        with:
V
vben 已提交
27
          node-version: '16.x'
V
Vben 已提交
28

V
vben 已提交
29 30 31 32 33 34 35 36 37 38 39
      # - name: Get yarn cache
      #   id: yarn-cache
      #   run: echo "::set-output name=dir::$(yarn cache dir)"

      # - name: Cache dependencies
      #   uses: actions/cache@v2
      #   with:
      #     path: ${{ steps.yarn-cache.outputs.dir }}
      #     key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
      #     restore-keys: |
      #       ${{ runner.os }}-yarn-
V
Vben 已提交
40 41 42

      - name: Build
        run: |
V
vben 已提交
43 44
          yarn cache clean
          rm -rf ./node_modules yarn.lock
V
Vben 已提交
45 46 47 48 49 50 51 52 53 54 55 56 57 58
          yarn install
          yarn run build

      - name: Deploy
        uses: SamKirkland/FTP-Deploy-Action@2.0.0
        env:
          FTP_SERVER: ${{ secrets.FTP_SERVER }}
          FTP_USERNAME: ${{ secrets.FTP_USERNAME }}
          FTP_PASSWORD: ${{ secrets.FTP_PASSWORD }}
          METHOD: sftp
          PORT: ${{ secrets.FTP_PORT }}
          LOCAL_DIR: dist
          REMOTE_DIR: /srv/www/vben-admin
          ARGS: --delete --verbose --parallel=80