mirror of
				https://github.com/easingthemes/ssh-deploy.git
				synced 2025-10-30 23:30:09 +08:00 
			
		
		
		
	Merge branch 'master' into feature/SSH-DEPLOY-refactor
# Conflicts: # .gitignore # README.md # dist/index.js # src/index.js
This commit is contained in:
		
						commit
						62063532be
					
				
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -17,5 +17,5 @@ node_modules/ | |||||||
| .env | .env | ||||||
| .env.test | .env.test | ||||||
| 
 | 
 | ||||||
| # Ide | # IDE | ||||||
| .idea | .idea | ||||||
|  | |||||||
							
								
								
									
										18
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										18
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							| @ -623,7 +623,7 @@ const sshDeploy = (() => { | |||||||
| })(); | })(); | ||||||
| 
 | 
 | ||||||
| const run = () => { | const run = () => { | ||||||
|   validateInputs([SSH_PRIVATE_KEY, REMOTE_HOST, REMOTE_USER]); |   validateInputs({ SSH_PRIVATE_KEY, REMOTE_HOST, REMOTE_USER }); | ||||||
| 
 | 
 | ||||||
|   sshDeploy.init({ |   sshDeploy.init({ | ||||||
|     src: `${GITHUB_WORKSPACE}/${SOURCE}` || '', |     src: `${GITHUB_WORKSPACE}/${SOURCE}` || '', | ||||||
| @ -663,7 +663,7 @@ const validateRsync = (callback = () => {}) => { | |||||||
|       'sudo apt-get --no-install-recommends install rsync', |       'sudo apt-get --no-install-recommends install rsync', | ||||||
|       (err, data, stderr) => { |       (err, data, stderr) => { | ||||||
|         if (err) { |         if (err) { | ||||||
|           console.log('⚠️ [CLI] Rsync installation failed ', err.message); |           console.log('⚠️ [CLI] Rsync installation failed. Aborting ... ', err.message); | ||||||
|           process.abort(); |           process.abort(); | ||||||
|         } else { |         } else { | ||||||
|           console.log('✅ [CLI] Rsync installed. \n', data, stderr); |           console.log('✅ [CLI] Rsync installed. \n', data, stderr); | ||||||
| @ -677,15 +677,19 @@ const validateRsync = (callback = () => {}) => { | |||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| const validateInputs = (inputs) => { | const validateInputs = (inputs) => { | ||||||
|   const validInputs = inputs.filter((input) => { |   const inputKeys = Object.keys(inputs); | ||||||
|     if (!input) { |   const validInputs = inputKeys.filter((inputKey) => { | ||||||
|       console.error(`⚠️ ${input} is mandatory`); |     const inputValue = inputs[inputKey]; | ||||||
|  | 
 | ||||||
|  |     if (!inputValue) { | ||||||
|  |       console.error(`⚠️ [INPUTS] ${inputKey} is mandatory`); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     return input; |     return inputValue; | ||||||
|   }); |   }); | ||||||
| 
 | 
 | ||||||
|   if (validInputs.length !== inputs.length) { |   if (validInputs.length !== inputKeys.length) { | ||||||
|  |     console.error(`⚠️ [INPUTS] Inputs not valid, aborting ...`); | ||||||
|     process.abort(); |     process.abort(); | ||||||
|   } |   } | ||||||
| }; | }; | ||||||
|  | |||||||
| @ -16,7 +16,8 @@ | |||||||
|   }, |   }, | ||||||
|   "scripts": { |   "scripts": { | ||||||
|     "build": "npm run lint && ncc build ./src/index.js -o dist", |     "build": "npm run lint && ncc build ./src/index.js -o dist", | ||||||
|     "lint": "eslint ./src/index.js" |     "lint": "eslint ./src/index.js", | ||||||
|  |     "lint:fix": "eslint ./src/index.js --fix" | ||||||
|   }, |   }, | ||||||
|   "repository": { |   "repository": { | ||||||
|     "type": "git", |     "type": "git", | ||||||
|  | |||||||
| @ -59,7 +59,7 @@ const sshDeploy = (() => { | |||||||
| })(); | })(); | ||||||
| 
 | 
 | ||||||
| const run = () => { | const run = () => { | ||||||
|   validateInputs([SSH_PRIVATE_KEY, REMOTE_HOST, REMOTE_USER]); |   validateInputs({ SSH_PRIVATE_KEY, REMOTE_HOST, REMOTE_USER }); | ||||||
| 
 | 
 | ||||||
|   sshDeploy.init({ |   sshDeploy.init({ | ||||||
|     src: `${GITHUB_WORKSPACE}/${SOURCE}` || '', |     src: `${GITHUB_WORKSPACE}/${SOURCE}` || '', | ||||||
|  | |||||||
| @ -9,7 +9,7 @@ const validateRsync = (callback = () => {}) => { | |||||||
|       'sudo apt-get --no-install-recommends install rsync', |       'sudo apt-get --no-install-recommends install rsync', | ||||||
|       (err, data, stderr) => { |       (err, data, stderr) => { | ||||||
|         if (err) { |         if (err) { | ||||||
|           console.log('⚠️ [CLI] Rsync installation failed ', err.message); |           console.log('⚠️ [CLI] Rsync installation failed. Aborting ... ', err.message); | ||||||
|           process.abort(); |           process.abort(); | ||||||
|         } else { |         } else { | ||||||
|           console.log('✅ [CLI] Rsync installed. \n', data, stderr); |           console.log('✅ [CLI] Rsync installed. \n', data, stderr); | ||||||
| @ -23,15 +23,19 @@ const validateRsync = (callback = () => {}) => { | |||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| const validateInputs = (inputs) => { | const validateInputs = (inputs) => { | ||||||
|   const validInputs = inputs.filter((input) => { |   const inputKeys = Object.keys(inputs); | ||||||
|     if (!input) { |   const validInputs = inputKeys.filter((inputKey) => { | ||||||
|       console.error(`⚠️ ${input} is mandatory`); |     const inputValue = inputs[inputKey]; | ||||||
|  | 
 | ||||||
|  |     if (!inputValue) { | ||||||
|  |       console.error(`⚠️ [INPUTS] ${inputKey} is mandatory`); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     return input; |     return inputValue; | ||||||
|   }); |   }); | ||||||
| 
 | 
 | ||||||
|   if (validInputs.length !== inputs.length) { |   if (validInputs.length !== inputKeys.length) { | ||||||
|  |     console.error(`⚠️ [INPUTS] Inputs not valid, aborting ...`); | ||||||
|     process.abort(); |     process.abort(); | ||||||
|   } |   } | ||||||
| }; | }; | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Dragan Filipovic
						Dragan Filipovic