-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
60 additions
and
18 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,23 @@ | ||
name: Continuous Deploy #action名称 | ||
on: [push] #在推送的时候运行此action | ||
name: Continuous Deploy | ||
on: [push] | ||
|
||
jobs: | ||
deploy_job: | ||
runs-on: ubuntu-latest #运行环境 | ||
runs-on: ubuntu-latest | ||
name: sftp | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
# 利用action把build好的文件上传到服务器/var/www/react-app路径下,需要确认此目录已在服务端创建 | ||
- name: deploy file to server | ||
uses: ./ # Uses an action in the root directory | ||
with: | ||
username: 'root' #ssh user name | ||
server: '${{ secrets.SERVER_IP }}' | ||
username: 'wl' | ||
server: '${{ secrets.MAC_IP }}' | ||
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
local_path: './action.yml' # 对应我们项目build的文件夹路径 | ||
remote_path: '/var/www/react-app/' | ||
# delete_remote_files: true | ||
local_path: './*' | ||
remote_path: '/Users/wl/Downloads/t/a' | ||
sftpArgs: '-o ConnectTimeout=5' | ||
# sftp_only: true | ||
password: ${{secrets.SSH_PASSWORD}} | ||
# delete_remote_files: true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,8 +16,14 @@ | |
`local_path`| yes| ./* | `local_path` of you project, if you want put single file:use path like `./myfile`, if you want put directory: use path like `./static/*`, it will put all files under `static` directory. Default to `./*`(will put all files in your repo). | ||
`remote_path`|yes|| Remote path | ||
`sftp_only`| no| | If your port only accepts the sftp protocol, set this option to `true`. However, please note that when this option is set to `true`, the remote folder will not be created automatically. | ||
`args` | no| | other args yor want to use of sftp, E.g.`-o ConnectTimeout=5` | ||
`delete_remote_files` | no | false | Set `true` will delete all files in the remote path before upload. Please be `careful` set this to true | ||
<strike>args</strike> `sftpArgs` | no| | other args yor want to use of sftp, E.g.`-o ConnectTimeout=5` | ||
`delete_remote_files` | no | false | **Warning** Set `true` will delete all files in the remote path before upload. Please be `careful` set this to true | ||
`passowrd`| no| | SSH passsword,If a password is set, `ssh_private_key` is ignored | ||
|
||
> **Warning** | ||
> be `careful` when use `delete_remote_files` This will remove all files in your remote path before uploading | ||
|
||
|
||
## Action Example | ||
|
||
|
@@ -62,14 +68,14 @@ | |
run: yarn build | ||
|
||
- name: deploy file to server | ||
uses: wlixcc/[email protected].3 | ||
uses: wlixcc/[email protected].4 | ||
with: | ||
username: 'root' | ||
server: '${{ secrets.SERVER_IP }}' | ||
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
local_path: './build/*' | ||
remote_path: '/var/www/react-app' | ||
args: '-o ConnectTimeout=5' | ||
sftpArgs: '-o ConnectTimeout=5' | ||
![](./resource/reactExample.jpg) | ||
|
||
|
@@ -96,14 +102,14 @@ | |
run: yarn build | ||
|
||
- name: deploy file to server | ||
uses: wlixcc/[email protected].3 | ||
uses: wlixcc/[email protected].4 | ||
with: | ||
username: 'root' | ||
server: '${{ secrets.SERVER_IP }}' | ||
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
local_path: './dist/*' | ||
remote_path: '/var/www/umiapp' | ||
args: '-o ConnectTimeout=5' | ||
sftpArgs: '-o ConnectTimeout=5' | ||
![](./resource/umiExample.jpg) | ||
|
||
|
||
|
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
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