ssh-deploy
ssh-deploy copied to clipboard
deploy to server is slowly
when I use this action, deploy to server always spend many time.
And my yml is as follows:
name: deploy
on:
push:
branches:
- master
paths-ignore: # 变更不触发部署
- README.md
pull_request:
branches:
- master
paths-ignore: # 变更不触发部署
- README.md
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master
- name: cache node_modules
uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }}
- name: install dependencies
run: npm install
- name: build
run: npm run build
- name: Deploy to Server
uses: easingthemes/[email protected]
env:
SSH_PRIVATE_KEY: ${{ secrets.DEPLOY_KEY }}
SOURCE: "build/"
REMOTE_HOST: ${{ secrets.SSH_HOST }}
REMOTE_USER: ${{ secrets.SSH_USERNAME }}
TARGET: ${{ secrets.REMOTE_TARGET }}
@yinguangyao, I had the same problem.
Then, I found this post, which helped me with the flags setup.
It recommends to use -rlgoDzvc
instead of -rltgoDzvO
since the modification time of freshly checked out files is always different from those on server. So rsync
sends all the files to the server.
I switched to those flags as well and it drastically decreased the deploy time from ~4 minutes to 12 seconds:
Hope this helps!
Yep. I agree that "c" is for checksum and will be better to update that in doc for convenient and fix some future new issues there. I'am for adding to ARGS section, link to man page of rsync
- name: Deploy to Aliyun Server
uses: easingthemes/[email protected]
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_KEY }}
ARGS: "-rlgoDzvc --delete"
SOURCE: ${{ secrets.SOURCE }}
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
REMOTE_USER: ${{ secrets.USER_NAME }}
TARGET: ${{ secrets.TARGET }}
I also met this probleam and solved it.
@easingthemes pls update this readme adding -c
to ARGS :
https://github.com/easingthemes/ssh-deploy#usage
Before:
ARGS: "-rltgoDzvO"
After:
ARGS: "-rltgoDzvOc"
Help other :)
Updated, both readme and default option used in the action. I had to publish major release to not break current usage.