schedule-push-to-ftp #1337
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: schedule-push-to-ftp | |
# Timed deployment project | |
on: | |
push: | |
schedule: | |
- cron: '0 20 * * *' | |
jobs: | |
schedule-push-to-ftp: | |
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 = /thin/next/#g' ./.env.production | |
sed -i "s#VITE_BUILD_COMPRESS\s*=.*#VITE_BUILD_COMPRESS = 'gzip'#g" ./.env.production | |
sed -i "s#VITE_DROP_CONSOLE\s*=.*#VITE_DROP_CONSOLE = true#g" ./.env.production | |
cat ./.env.production | |
- name: use Node.js 16 | |
uses: actions/[email protected] | |
with: | |
node-version: '16.x' | |
- 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- | |
- name: Build | |
run: | | |
yarn install | |
yarn run build | |
- name: Deploy | |
uses: SamKirkland/[email protected] | |
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-thin | |
ARGS: --delete --verbose --parallel=80 |