mirror of
				https://github.com/SamKirkland/FTP-Deploy-Action.git
				synced 2025-10-31 19:54:01 +00:00 
			
		
		
		
	hooked up additional props
added npm badges Updated readme
This commit is contained in:
		
							parent
							
								
									64fd8ab1ea
								
							
						
					
					
						commit
						afd59edb41
					
				
							
								
								
									
										7
									
								
								.github/ISSUE_TEMPLATE/bug_report.md
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								.github/ISSUE_TEMPLATE/bug_report.md
									
									
									
									
										vendored
									
									
								
							| @ -12,8 +12,11 @@ A clear and concise description of what the bug is. | ||||
| 
 | ||||
| **My Action Config** | ||||
| ```yaml | ||||
| on: | ||||
|   push: | ||||
| on: push | ||||
| name: Publish Website | ||||
| jobs: | ||||
|   web-deploy: | ||||
|     name: 🚀 Deploy website every commit | ||||
|     # !!!!!!! TODO Fill Out !!!!!!! | ||||
| ``` | ||||
| 
 | ||||
|  | ||||
							
								
								
									
										2
									
								
								.github/workflows/ftp.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/ftp.yml
									
									
									
									
										vendored
									
									
								
							| @ -7,7 +7,7 @@ on: | ||||
|     branches: [ master ] | ||||
| 
 | ||||
| jobs: | ||||
|   deploy: # make sure the action works on a clean machine without building | ||||
|   deploy: | ||||
|     name: 🚀 Deploy website every commit | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|  | ||||
							
								
								
									
										2
									
								
								.github/workflows/ftps.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/ftps.yml
									
									
									
									
										vendored
									
									
								
							| @ -7,7 +7,7 @@ on: | ||||
|     branches: [ master ] | ||||
| 
 | ||||
| jobs: | ||||
|   deploy: # make sure the action works on a clean machine without building | ||||
|   deploy: | ||||
|     name: 🚀 Deploy website every commit | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|  | ||||
							
								
								
									
										28
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										28
									
								
								README.md
									
									
									
									
									
								
							| @ -9,16 +9,19 @@ Automate deploying websites and more with this GitHub action | ||||
|  | ||||
|  | ||||
| 
 | ||||
|  | ||||
|  | ||||
| 
 | ||||
| --- | ||||
| 
 | ||||
| ### Usage Example | ||||
| Place the following in `/.github/workflows/main.yml` | ||||
| ```yml | ||||
| on: push | ||||
| name: Publish Website | ||||
| name: 🚀 Deploy website on push | ||||
| jobs: | ||||
|   web-deploy: | ||||
|     name: 🚀 Deploy website every commit | ||||
|     name: 🎉 Deploy | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|     - name: 🚚 Get latest code | ||||
| @ -66,10 +69,10 @@ I strongly recommend you store your `password` as a secret. | ||||
| | `local-dir`             | No       | `./myFolderToPublish/`     | `./`                                                     | Path to upload to on the server, must end with trailing slash `/`                                                                                            | | ||||
| | `server-dir`            | No       | `public_html/www/`         | `./`                                                     | Folder to upload from, must end with trailing slash `/`                                                                                                      | | ||||
| | `state-name`            | No       | `folder/.sync-state.json`  | `.ftp-deploy-sync-state.json`                            | Custom                                                                                                                                                       | | ||||
| | `dry-run`               | No       | `true`                     | `false`                                                  | :warning: todo - Prints which modifications will be made with current config options, but doesn't actually make any changes                                  | | ||||
| | `dangerous-clean-slate` | No       | `true`                     | `false`                                                  | :warning: todo - Deletes ALL contents of server-dir, even items in excluded with 'exclude' argument                                                          | | ||||
| | `include`               | No       |                            | ``                                                       | :warning: todo - An array of glob patterns, these files will always be included in the publish/delete process - even if no change occurred                   | | ||||
| | `exclude`               | No       |                            | `.git*` `.git*/**` `node_modules/**` `node_modules/**/*` | :warning: todo - An array of glob patterns, these files will not be included in the publish/delete process                                                   | | ||||
| | `dry-run`               | No       | `true`                     | `false`                                                  | Prints which modifications will be made with current config options, but doesn't actually make any changes                                                   | | ||||
| | `dangerous-clean-slate` | No       | `true`                     | `false`                                                  | Deletes ALL contents of server-dir, even items in excluded with 'exclude' argument                                                                           | | ||||
| | `include`               | No       |                            | ``                                                       | :warning: not implemented yet - An array of glob patterns, these files will always be included in the publish/delete process - even if no change occurred    | | ||||
| | `exclude`               | No       |                            | `.git*` `.git*/**` `node_modules/**` `node_modules/**/*` | An array of glob patterns, these files will not be included in the publish/delete process                                                                    | | ||||
| | `log-level`             | No       | `info`                     | `info`                                                   | `warn`: only important/warning info, `info`: default, log important/warning info & progress info, `debug`: log everything for debugging                      | | ||||
| 
 | ||||
| 
 | ||||
| @ -79,10 +82,10 @@ Make sure you have an npm script named 'build'. This config should work for most | ||||
| 
 | ||||
| ```yml | ||||
| on: push | ||||
| name: Publish Website | ||||
| name: 🚀 Deploy website on push | ||||
| jobs: | ||||
|   web-deploy: | ||||
|     name: 🚀 Deploy website every commit | ||||
|     name: 🎉 Deploy | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|     - name: 🚚 Get latest code | ||||
| @ -109,10 +112,10 @@ jobs: | ||||
| #### FTPS | ||||
| ```yml | ||||
| on: push | ||||
| name: Publish Website Dry Run | ||||
| name: 🚀 Deploy website on push | ||||
| jobs: | ||||
|   web-deploy: | ||||
|     name: 🚀 Deploy website every commit | ||||
|     name: 🎉 Deploy | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|     - name: 🚚 Get latest code | ||||
| @ -125,16 +128,17 @@ jobs: | ||||
|         username: myFtpUserName | ||||
|         password: ${{ secrets.password }} | ||||
|         protocol: ftps | ||||
|         port: 1234 # todo replace with your web hosts ftps port | ||||
| ``` | ||||
| 
 | ||||
| #### Log only dry run: Use this mode for testing | ||||
| Ouputs a list of files that will be created/modified to sync your source without making any actual changes | ||||
| ```yml | ||||
| on: push | ||||
| name: Publish Website Dry Run | ||||
| name: 🚀 Deploy website on push | ||||
| jobs: | ||||
|   web-deploy: | ||||
|     name: 🚀 Deploy website every commit | ||||
|     name: 🎉 Deploy | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|     - name: 🚚 Get latest code | ||||
|  | ||||
							
								
								
									
										9129
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										9129
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										110
									
								
								src/main.ts
									
									
									
									
									
								
							
							
						
						
									
										110
									
								
								src/main.ts
									
									
									
									
									
								
							| @ -1,4 +1,4 @@ | ||||
| import * as core from "@actions/core"; | ||||
| import core from "@actions/core"; | ||||
| import { deploy } from "@samkirkland/ftp-deploy"; | ||||
| import { IFtpDeployArguments } from "@samkirkland/ftp-deploy/dist/module/types"; | ||||
| 
 | ||||
| @ -7,16 +7,16 @@ async function runDeployment() { | ||||
|     server: core.getInput("server", { required: true }), | ||||
|     username: core.getInput("username", { required: true }), | ||||
|     password: core.getInput("password", { required: true }), | ||||
|     protocol: core.getInput("protocol") as any, // todo fix
 | ||||
|     port: core.getInput("port") as any, // todo fix
 | ||||
|     "local-dir": core.getInput("local-dir") as any, // todo fix
 | ||||
|     "server-dir": core.getInput("server-dir") as any, // todo fix
 | ||||
|     "state-name": core.getInput("state-name") as any, // todo fix
 | ||||
|     "dry-run": core.getInput("dry-run") as any, // todo fix
 | ||||
|     "dangerous-clean-slate": core.getInput("dangerous-clean-slate") as any, // todo fix
 | ||||
|     "include": core.getInput("include") as any, // todo fix
 | ||||
|     "exclude": core.getInput("exclude") as any, // todo fix
 | ||||
|     "log-level": core.getInput("log-level") as any // todo fix
 | ||||
|     protocol: optionalProtocol("protocol", core.getInput("protocol")), | ||||
|     port: optionalInt("port", core.getInput("port")), | ||||
|     "local-dir": core.getInput("local-dir"), | ||||
|     "server-dir": core.getInput("server-dir"), | ||||
|     "state-name": core.getInput("state-name"), | ||||
|     "dry-run": optionalBoolean("dry-run", core.getInput("dry-run")), | ||||
|     "dangerous-clean-slate": optionalBoolean("dangerous-clean-slate", core.getInput("dangerous-clean-slate")), | ||||
|     "include": optionalStringArray("include", core.getInput("include")), | ||||
|     "exclude": optionalStringArray("exclude", core.getInput("exclude")), | ||||
|     "log-level": optionalLogLevel("log-level", core.getInput("log-level")) | ||||
|   }; | ||||
| 
 | ||||
| 
 | ||||
| @ -28,4 +28,90 @@ async function runDeployment() { | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| runDeployment(); | ||||
| runDeployment(); | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| function optionalBoolean(argumentName: string, rawValue: string | undefined): boolean | undefined { | ||||
|   if (rawValue === undefined) { | ||||
|     return undefined; | ||||
|   } | ||||
| 
 | ||||
|   const cleanValue = rawValue.toLowerCase(); | ||||
|   if (cleanValue === "true") { | ||||
|     return true; | ||||
|   } | ||||
|   if (cleanValue === "false") { | ||||
|     return false; | ||||
|   } | ||||
| 
 | ||||
|   core.setFailed(`${argumentName}: invalid parameter - please use a boolean, you provided "${rawValue}". Try true or false instead.`); | ||||
| } | ||||
| 
 | ||||
| function optionalProtocol(argumentName: string, rawValue: string | undefined): "ftp" | "ftps" | "ftps-legacy" | undefined { | ||||
|   if (rawValue === undefined) { | ||||
|     return undefined; | ||||
|   } | ||||
| 
 | ||||
|   const cleanValue = rawValue.toLowerCase(); | ||||
|   if (cleanValue === "ftp") { | ||||
|     return "ftp"; | ||||
|   } | ||||
|   if (cleanValue === "ftps") { | ||||
|     return "ftps"; | ||||
|   } | ||||
|   if (cleanValue === "ftps-legacy") { | ||||
|     return "ftps-legacy"; | ||||
|   } | ||||
| 
 | ||||
|   core.setFailed(`${argumentName}: invalid parameter - you provided "${rawValue}". Try "ftp", "ftps", or "ftps-legacy" instead.`); | ||||
| } | ||||
| 
 | ||||
| function optionalLogLevel(argumentName: string, rawValue: string | undefined): "warn" | "info" | "debug" | undefined { | ||||
|   if (rawValue === undefined) { | ||||
|     return undefined; | ||||
|   } | ||||
| 
 | ||||
|   const cleanValue = rawValue.toLowerCase(); | ||||
|   if (cleanValue === "warn") { | ||||
|     return "warn"; | ||||
|   } | ||||
|   if (cleanValue === "info") { | ||||
|     return "info"; | ||||
|   } | ||||
|   if (cleanValue === "debug") { | ||||
|     return "debug"; | ||||
|   } | ||||
| 
 | ||||
|   core.setFailed(`${argumentName}: invalid parameter - you provided "${rawValue}". Try "warn", "info", or "debug" instead.`); | ||||
| } | ||||
| 
 | ||||
| function optionalInt(argumentName: string, rawValue: string | undefined): number | undefined { | ||||
|   if (rawValue === undefined) { | ||||
|     return undefined; | ||||
|   } | ||||
| 
 | ||||
|   const cleanValue = rawValue.toLowerCase(); | ||||
|   const valueAsNumber = parseFloat(cleanValue); | ||||
| 
 | ||||
|   if (Number.isInteger(valueAsNumber)) { | ||||
|     return valueAsNumber; | ||||
|   } | ||||
| 
 | ||||
|   core.setFailed(`${argumentName}: invalid parameter - you provided "${rawValue}". Try a whole number (no decimals) instead like 1234`); | ||||
| } | ||||
| 
 | ||||
| function optionalStringArray(argumentName: string, rawValue: string | undefined): string[] | undefined { | ||||
|   if (rawValue === undefined) { | ||||
|     return undefined; | ||||
|   } | ||||
| 
 | ||||
|   // split value by space and comma
 | ||||
|   return rawValue.split(", "); | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user