mirror of
				https://github.com/appleboy/scp-action.git
				synced 2025-10-31 19:53:47 +00:00 
			
		
		
		
	docs: update readme.
This commit is contained in:
		
							parent
							
								
									afd2e26f9f
								
							
						
					
					
						commit
						c0a815a115
					
				
							
								
								
									
										9
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										9
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
								
							| @ -9,12 +9,11 @@ jobs: | ||||
|     - uses: actions/checkout@master | ||||
|     - name: copy file via ssh password | ||||
|       uses: appleboy/scp-action@master | ||||
|       env: | ||||
|         HOST: ${{ secrets.HOST }} | ||||
|         USERNAME: ${{ secrets.USERNAME }} | ||||
|         PASSWORD: ${{ secrets.PASSWORD }} | ||||
|         PORT: ${{ secrets.PORT }} | ||||
|       with: | ||||
|         host: ${{ secrets.HOST }} | ||||
|         username: ${{ secrets.USERNAME }} | ||||
|         password: ${{ secrets.PASSWORD }} | ||||
|         port: ${{ secrets.PORT }} | ||||
|         source: "tests/a.txt,tests/b.txt" | ||||
|         target: "test" | ||||
| 
 | ||||
|  | ||||
							
								
								
									
										190
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										190
									
								
								README.md
									
									
									
									
									
								
							| @ -2,27 +2,23 @@ | ||||
| 
 | ||||
| [GitHub Action](https://developer.github.com/actions/) for copying files and artifacts via SSH. | ||||
| 
 | ||||
| <img src="./images/copy-multiple-file.png"> | ||||
|  | ||||
| 
 | ||||
| ## Usage | ||||
| 
 | ||||
| copy files and artifacts via SSH as blow. | ||||
| 
 | ||||
| ``` | ||||
| action "Copy multiple file" { | ||||
|   uses = "appleboy/scp-action@master" | ||||
|   env = { | ||||
|     HOST = "example.com" | ||||
|     USERNAME = "foo" | ||||
|     PASSWORD = "bar" | ||||
|     PORT = "22" | ||||
|     SOURCE = "tests/a.txt,tests/b.txt" | ||||
|     TARGET = "/home/foo/test" | ||||
|   } | ||||
|   secrets = [ | ||||
|     "PASSWORD", | ||||
|   ] | ||||
| } | ||||
| ```yaml | ||||
| - name: copy file via ssh password | ||||
|   uses: appleboy/scp-action@master | ||||
|   env: | ||||
|     HOST: ${{ secrets.HOST }} | ||||
|     USERNAME: ${{ secrets.USERNAME }} | ||||
|     PASSWORD: ${{ secrets.PASSWORD }} | ||||
|     PORT: ${{ secrets.PORT }} | ||||
|   with: | ||||
|     source: "tests/a.txt,tests/b.txt" | ||||
|     target: "test | ||||
| ``` | ||||
| 
 | ||||
| ## Environment variables | ||||
| @ -39,127 +35,75 @@ action "Copy multiple file" { | ||||
| 
 | ||||
| Copy file via ssh password | ||||
| 
 | ||||
| ``` | ||||
| action "Copy multiple file" { | ||||
|   uses = "appleboy/scp-action@master" | ||||
|   env = { | ||||
|     HOST = "example.com" | ||||
|     USERNAME = "foo" | ||||
|     PORT = "22" | ||||
|     SOURCE = "tests/a.txt,tests/b.txt" | ||||
|     TARGET = "/home/foo/test" | ||||
|   } | ||||
|   secrets = [ | ||||
|     "PASSWORD", | ||||
|   ] | ||||
| } | ||||
| ```yaml | ||||
| - name: copy file via ssh password | ||||
|   uses: appleboy/scp-action@master | ||||
|   with: | ||||
|     host: example.com | ||||
|     username: foo | ||||
|     password: bar | ||||
|     port: 22 | ||||
|     source: "tests/a.txt,tests/b.txt" | ||||
|     target: "test" | ||||
| ``` | ||||
| 
 | ||||
| Copy file via ssh key | ||||
| 
 | ||||
| ``` | ||||
| action "Copy file via ssh key" { | ||||
|   uses = "appleboy/scp-action@master" | ||||
|   env = { | ||||
|     HOST = "example.com" | ||||
|     USERNAME = "foo" | ||||
|     PORT = "22" | ||||
|     SOURCE = "tests/c.txt,tests/d.txt" | ||||
|     TARGET = "/home/actions/test" | ||||
|   } | ||||
|   secrets = [ | ||||
|     "KEY", | ||||
|   ] | ||||
| } | ||||
| ```yaml | ||||
| - name: copy file via ssh key | ||||
|   uses: appleboy/scp-action@master | ||||
|   env: | ||||
|     HOST: ${{ secrets.HOST }} | ||||
|     USERNAME: ${{ secrets.USERNAME }} | ||||
|     PORT: ${{ secrets.PORT }} | ||||
|     KEY: ${{ secrets.KEY }} | ||||
|   with: | ||||
|     source: "tests/a.txt,tests/b.txt" | ||||
|     target: "test" | ||||
| ``` | ||||
| 
 | ||||
| Example configuration for ignore list: | ||||
| 
 | ||||
| ``` | ||||
| action "reqular expression list" { | ||||
|   uses = "appleboy/scp-action@master" | ||||
|   env = { | ||||
|     HOST = "example.com" | ||||
|     USERNAME = "foo" | ||||
|     PORT = "22" | ||||
|     SOURCE = "tests/*.txt,!tests/a.txt" | ||||
|     TARGET = "/home/actions/test" | ||||
|   } | ||||
|   secrets = [ | ||||
|     "KEY", | ||||
|   ] | ||||
| } | ||||
| ```yaml | ||||
| - name: copy file via ssh key | ||||
|   uses: appleboy/scp-action@master | ||||
|   env: | ||||
|     HOST: ${{ secrets.HOST }} | ||||
|     USERNAME: ${{ secrets.USERNAME }} | ||||
|     PORT: ${{ secrets.PORT }} | ||||
|     KEY: ${{ secrets.KEY }} | ||||
|   with: | ||||
|     source: "tests/*.txt,!tests/a.txt" | ||||
|     target: "test" | ||||
| ``` | ||||
| 
 | ||||
| Example configuration for multiple server | ||||
| 
 | ||||
| ```diff | ||||
| action "reqular expression list" { | ||||
|   uses = "appleboy/scp-action@master" | ||||
|   env = { | ||||
| -   HOST = "example.com" | ||||
| +   HOST = "foo.com,bar.com" | ||||
|     USERNAME = "foo" | ||||
|     PORT = "22" | ||||
|     SOURCE = "tests/*.txt,!tests/a.txt" | ||||
|     TARGET = "/home/actions/test" | ||||
|   } | ||||
|   secrets = [ | ||||
|     "KEY", | ||||
|   ] | ||||
| } | ||||
| - name: copy file via ssh password | ||||
|   uses: appleboy/scp-action@master | ||||
|   with: | ||||
| -   host: "example.com" | ||||
| +   host: "foo.com,bar.com" | ||||
|     username: foo | ||||
|     password: bar | ||||
|     port: 22 | ||||
|     source: "tests/a.txt,tests/b.txt" | ||||
|     target: "test" | ||||
| ``` | ||||
| 
 | ||||
| Example configuration for custom secret for ssh password | ||||
| ## Input variables | ||||
| 
 | ||||
| ``` | ||||
| action "Add secret in args" { | ||||
|   uses = "appleboy/scp-action@master" | ||||
|   env = { | ||||
|     TARGET = "/home/actions/test1234" | ||||
|   } | ||||
|   secrets = [ | ||||
|     "HOST", | ||||
|     "TEST_USERNAME", | ||||
|     "TEST_PASSWORD", | ||||
|     "KEY", | ||||
|   ] | ||||
|   args = [ | ||||
|     "--username", "$TEST_USERNAME", | ||||
|     "--password", "$TEST_PASSWORD", | ||||
|     "--source", "tests/a.txt", | ||||
|     "--source", "tests/b.txt", | ||||
|   ] | ||||
| } | ||||
| ``` | ||||
| see the [action.yml](./action.yml) file for more detail imformation. | ||||
| 
 | ||||
| see the detail of `drone-scp` command | ||||
| 
 | ||||
| ``` | ||||
|    --host value, -H value             Server host [$PLUGIN_HOST, $SCP_HOST, $SSH_HOST, $HOST] | ||||
|    --port value, -P value             Server port, default to 22 (default: "22") [$PLUGIN_PORT, $SCP_PORT, $SSH_PORT, $PORT] | ||||
|    --username value, -u value         Server username [$PLUGIN_USERNAME, $PLUGIN_USER, $SCP_USERNAME, $SSH_USERNAME, $USERNAME] | ||||
|    --password value, -p value         Password for password-based authentication [$PLUGIN_PASSWORD, $SCP_PASSWORD, $SSH_PASSWORD, $PASSWORD] | ||||
|    --timeout value                    connection timeout (default: 0s) [$PLUGIN_TIMEOUT, $SCP_TIMEOUT] | ||||
|    --command.timeout value, -T value  command timeout (default: 1m0s) [$PLUGIN_COMMAND_TIMEOUT, $SSH_COMMAND_TIMEOUT] | ||||
|    --key value, -k value              ssh private key [$PLUGIN_KEY, $SCP_KEY, $SSH_KEY, $KEY] | ||||
|    --key-path value, -i value         ssh private key path [$PLUGIN_KEY_PATH, $SCP_KEY_PATH, $SSH_KEY_PATH] | ||||
|    --target value, -t value           Target path on the server [$PLUGIN_TARGET, $SCP_TARGET, $TARGET] | ||||
|    --source value, -s value           scp file list [$PLUGIN_SOURCE, $SCP_SOURCE, $SOURCE] | ||||
|    --rm, -r                           remove target folder before upload data [$PLUGIN_RM, $SCP_RM, $RM] | ||||
|    --proxy.ssh-key value              private ssh key of proxy [$PLUGIN_PROXY_SSH_KEY, $PLUGIN_PROXY_KEY, $PROXY_SSH_KEY, $PROXY_KEY] | ||||
|    --proxy.key-path value             ssh private key path of proxy [$PLUGIN_PROXY_KEY_PATH, $PROXY_SSH_KEY_PATH] | ||||
|    --proxy.username value             connect as user of proxy (default: "root") [$PLUGIN_PROXY_USERNAME, $PLUGIN_PROXY_USER, $PROXY_SSH_USERNAME, $PROXY_USERNAME] | ||||
|    --proxy.password value             user password of proxy [$PLUGIN_PROXY_PASSWORD, $PROXY_SSH_PASSWORD, $PROXY_PASSWORD] | ||||
|    --proxy.host value                 connect to host of proxy [$PLUGIN_PROXY_HOST, $PROXY_SSH_HOST, $PROXY_HOST] | ||||
|    --proxy.port value                 connect to port of proxy (default: "22") [$PLUGIN_PROXY_PORT, $PROXY_SSH_PORT, $PROXY_PORT] | ||||
|    --proxy.timeout value              proxy connection timeout (default: 0s) [$PLUGIN_PROXY_TIMEOUT, $PROXY_SSH_TIMEOUT] | ||||
|    --strip.components value           Remove the specified number of leading path elements. (default: 0) [$PLUGIN_STRIP_COMPONENTS, $TAR_STRIP_COMPONENTS] | ||||
|    --tar.exec tar                     Alternative tar executable to on the dest host (default: "tar") [$PLUGIN_TAR_EXEC, $SCP_TAR_EXEC] | ||||
|    --debug                            remove target folder before upload data [$PLUGIN_DEBUG, $DEBUG] | ||||
| ``` | ||||
| 
 | ||||
| ## Secrets | ||||
| 
 | ||||
| * `PASSWORD` - ssh server password | ||||
| * `KEY` - ssh server private key | ||||
| * host - scp remote host | ||||
| * port - scp remote port | ||||
| * username - scp username | ||||
| * password - scp password | ||||
| * timeout - timeout for ssh to remote host | ||||
| * command_timeout - timeout for scp command | ||||
| * key - content of ssh private key. ex raw content of ~/.ssh/id_rsa | ||||
| * key_path - path of ssh private key | ||||
| * target - target path on the server | ||||
| * source - scp file list | ||||
| * rm - remove target folder before upload data | ||||
|  | ||||
| @ -19,7 +19,7 @@ inputs: | ||||
|   key_path: | ||||
|     description: 'path of ssh private key' | ||||
|   target: | ||||
|     description: 'Target path on the server' | ||||
|     description: 'target path on the server' | ||||
|   source: | ||||
|     description: 'scp file list' | ||||
|   rm: | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user