mirror of
				https://github.com/easingthemes/ssh-deploy.git
				synced 2025-10-30 23:30:09 +08:00 
			
		
		
		
	feat: Add SSH remote script support
This commit is contained in:
		
							parent
							
								
									cf98c7e8be
								
							
						
					
					
						commit
						d39592cf3a
					
				
							
								
								
									
										23
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								README.md
									
									
									
									
									
								
							| @ -1,6 +1,8 @@ | |||||||
| # ssh deployments | # ssh deployments | ||||||
| 
 | 
 | ||||||
| Deploy code with rsync over ssh, using NodeJS. | Deploy code with rsync over ssh. | ||||||
|  | 
 | ||||||
|  | Execute remote scripts before or after rsync | ||||||
| 
 | 
 | ||||||
| NodeJS version is more than a minute `faster` than simple Docker version. | NodeJS version is more than a minute `faster` than simple Docker version. | ||||||
| 
 | 
 | ||||||
| @ -8,6 +10,8 @@ This GitHub Action deploys specific directory from `GITHUB_WORKSPACE` to a folde | |||||||
| 
 | 
 | ||||||
| This action would usually follow a build/test action which leaves deployable code in `GITHUB_WORKSPACE`, eg `dist`; | This action would usually follow a build/test action which leaves deployable code in `GITHUB_WORKSPACE`, eg `dist`; | ||||||
| 
 | 
 | ||||||
|  | In addition to rsync, this action provides scripts execution on remote host before and/or after rsync. | ||||||
|  | 
 | ||||||
| # Configuration | # Configuration | ||||||
| 
 | 
 | ||||||
| Pass configuration with `env` vars | Pass configuration with `env` vars | ||||||
| @ -53,6 +57,16 @@ The target directory | |||||||
| 
 | 
 | ||||||
| path to exclude separated by `,`, ie: `/dist/, /node_modules/` | path to exclude separated by `,`, ie: `/dist/, /node_modules/` | ||||||
| 
 | 
 | ||||||
|  | ##### 9. `SCRIPT_BEFORE` (optional, default '') | ||||||
|  | 
 | ||||||
|  | Script to run on host machine before rsync. Single line or multiline commands. | ||||||
|  | Execution is preformed by storing commands in `.sh` file and executing it via `.bash` over `ssh` | ||||||
|  | 
 | ||||||
|  | ##### 10. `SCRIPT_AFTER` (optional, default '') | ||||||
|  | 
 | ||||||
|  | Script to run on host machine after rsync. | ||||||
|  | Rsync output is stored in `$RSYNC_STDOUT` env variable. | ||||||
|  | 
 | ||||||
| # Usage | # Usage | ||||||
| 
 | 
 | ||||||
| Use the latest version from Marketplace,eg: ssh-deploy@v2 | Use the latest version from Marketplace,eg: ssh-deploy@v2 | ||||||
| @ -69,6 +83,13 @@ or use the latest version from a branch, eg: ssh-deploy@main | |||||||
|       REMOTE_USER: ${{ secrets.REMOTE_USER }} |       REMOTE_USER: ${{ secrets.REMOTE_USER }} | ||||||
|       TARGET: ${{ secrets.REMOTE_TARGET }} |       TARGET: ${{ secrets.REMOTE_TARGET }} | ||||||
|       EXCLUDE: "/dist/, /node_modules/" |       EXCLUDE: "/dist/, /node_modules/" | ||||||
|  |       SCRIPT_BEFORE: | | ||||||
|  |         whoami | ||||||
|  |         ls -al | ||||||
|  |       SCRIPT_AFTER: | | ||||||
|  |         whoami | ||||||
|  |         ls -al | ||||||
|  |         echo $RSYNC_STDOUT | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| # Example usage in workflow | # Example usage in workflow | ||||||
|  | |||||||
							
								
								
									
										14
									
								
								action.yml
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								action.yml
									
									
									
									
									
								
							| @ -1,9 +1,9 @@ | |||||||
| name: "ssh deploy" | name: "ssh deploy" | ||||||
| description: "NodeJS action for FAST deployment with rsync/ssh" | description: "NodeJS action for FAST deployment with rsync/ssh and remote script execution before/after rsync" | ||||||
| author: "easingthemes" | author: "easingthemes" | ||||||
| inputs: | inputs: | ||||||
|   SSH_PRIVATE_KEY: # Private Key |   SSH_PRIVATE_KEY: | ||||||
|     description: "Private Key" |     description: "Private key part of an SSH key pair" | ||||||
|     required: true |     required: true | ||||||
|   REMOTE_HOST: |   REMOTE_HOST: | ||||||
|     description: "Remote host" |     description: "Remote host" | ||||||
| @ -16,7 +16,7 @@ inputs: | |||||||
|     required: false |     required: false | ||||||
|     default: "22" |     default: "22" | ||||||
|   SOURCE: |   SOURCE: | ||||||
|     description: "Source directory" |     description: "Source directory, path relative to `$GITHUB_WORKSPACE` root, eg: `dist/`" | ||||||
|     required: false |     required: false | ||||||
|     default: "" |     default: "" | ||||||
|   TARGET: |   TARGET: | ||||||
| @ -32,17 +32,17 @@ inputs: | |||||||
|     required: false |     required: false | ||||||
|     default: "-o StrictHostKeyChecking=no" |     default: "-o StrictHostKeyChecking=no" | ||||||
|   EXCLUDE: |   EXCLUDE: | ||||||
|     description: "An array of folder to exclude" |     description: "paths to exclude separated by `,`, ie: `/dist/, /node_modules/`" | ||||||
|     required: false |     required: false | ||||||
|     default: "" |     default: "" | ||||||
|   SCRIPT_BEFORE: |   SCRIPT_BEFORE: | ||||||
|     description: "Script to run on host machine before rsync" |     description: "Script to run on host machine before rsync" | ||||||
|     required: false |     required: false | ||||||
|     default: "echo 'Before rsync'" |     default: "" | ||||||
|   SCRIPT_AFTER: |   SCRIPT_AFTER: | ||||||
|     description: "Script to run on host machine after rsync" |     description: "Script to run on host machine after rsync" | ||||||
|     required: false |     required: false | ||||||
|     default: "echo 'After rsync'" |     default: "" | ||||||
| outputs: | outputs: | ||||||
|   status: |   status: | ||||||
|     description: "Status" |     description: "Status" | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Dragan Filipovic
						Dragan Filipovic