mirror of
				https://github.com/SamKirkland/FTP-Deploy-Action.git
				synced 2025-10-31 23:34:00 +00:00 
			
		
		
		
	using act for local debugging
Added act library for local debugging Attempting to use exec argument escaping
This commit is contained in:
		
							parent
							
								
									b698c49eac
								
							
						
					
					
						commit
						ae5262e007
					
				
							
								
								
									
										16
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								README.md
									
									
									
									
									
								
							| @ -420,10 +420,13 @@ jobs: | ||||
| ## Debugging locally | ||||
| ##### Instructions for debugging Windows | ||||
| - [Install docker](https://docs.docker.com/get-docker/)   | ||||
| - Open powershell | ||||
| - Open powershell **as Administrator** | ||||
| - Install [act-cli](https://github.com/nektos/act#installation) by running `choco install act-cli` | ||||
| - Navigate to the repo folder | ||||
| - Run `docker build --tag action .` | ||||
| - Run `docker run action` | ||||
| - Run `npm install` - this will install all dependencies to build this project | ||||
| - Run `npm build` - this will build the action javascript and watch/rebuild when files change | ||||
| - Run `npm run build-docker` - this will build the docker container (only needs to be done once) | ||||
| - Run `npm run run-docker` - this will spin up a local copy of the action defined in `/debug/local-debug-deployment.yaml`. Update package.json to set any secret values | ||||
| 
 | ||||
| #### Instructions for debugging on Linux | ||||
| - [Install docker](https://docs.docker.com/get-docker/)   | ||||
| @ -432,8 +435,11 @@ On Linux you can install docker using your package manager, for example, on a De | ||||
| sudo apt install docker docker.io | ||||
| ``` | ||||
| - Open the terminal | ||||
| - Install [act-cli](https://github.com/nektos/act#installation) | ||||
| - Navigate to the repo folder | ||||
| - Run `docker build --tag action .` | ||||
| - Run `docker run action` | ||||
| - Run `npm install` - this will install all dependencies to build this project | ||||
| - Run `npm build` - this will build the action javascript and watch/rebuild when files change | ||||
| - Run `npm run build-docker` - this will build the docker container (only needs to be done once) | ||||
| - Run `npm run run-docker` - this will spin up a local copy of the action defined in `/debug/local-debug-deployment.yaml`. Update package.json to set any secret values | ||||
| 
 | ||||
| #### Pull Requests Welcome! | ||||
|  | ||||
							
								
								
									
										18
									
								
								debug/local-debug-deployment.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								debug/local-debug-deployment.yaml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,18 @@ | ||||
| on: push | ||||
| name: Local Debug Deployment | ||||
| jobs: | ||||
|   Local-Debug-Deployment: | ||||
|     name: Local-Debug-Deployment | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|     - uses: actions/checkout@v2.1.0 | ||||
|       with: | ||||
|         fetch-depth: 2 | ||||
|      | ||||
|     - name: FTP-Deploy-Action | ||||
|       uses: ./ | ||||
|       with: | ||||
|         ftp-server: ftp://ftp.samkirkland.com/ | ||||
|         ftp-username: ${{ secrets.username }} | ||||
|         ftp-password: ${{ secrets.password }} | ||||
|         git-ftp-args: --dry-run | ||||
							
								
								
									
										12
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							| @ -1049,11 +1049,19 @@ function syncFiles(args) { | ||||
|     return __awaiter(this, void 0, void 0, function* () { | ||||
|         try { | ||||
|             yield core.group("Uploading files", () => __awaiter(this, void 0, void 0, function* () { | ||||
|                 return yield exec.exec(`git ftp push --force --auto-init --verbose --syncroot ${args.local_dir} --user ${args.ftp_username} --passwd ${args.ftp_password} ${args.gitFtpArgs} ${args.ftp_server}`); | ||||
|                 return yield exec.exec("git ftp push", [ | ||||
|                     "--force", | ||||
|                     "--auto-init", | ||||
|                     "--verbose", | ||||
|                     `--syncroot=${args.local_dir}`, | ||||
|                     `--user=${args.ftp_username}`, | ||||
|                     `--passwd=${args.ftp_password}`, | ||||
|                     args.gitFtpArgs, | ||||
|                     args.ftp_server | ||||
|                 ]); | ||||
|             })); | ||||
|         } | ||||
|         catch (error) { | ||||
|             console.error("⚠️ Failed to upload files"); | ||||
|             core.setFailed(error.message); | ||||
|         } | ||||
|     }); | ||||
|  | ||||
| @ -8,10 +8,9 @@ | ||||
|     "node": ">=12.0.0" | ||||
|   }, | ||||
|   "scripts": { | ||||
|     "build:dev": "tsc", | ||||
|     "build:production": "ncc build src/main.ts -o dist", | ||||
|     "build:docker": "docker build --tag action .", | ||||
|     "run:docker": "docker run action --build-arg FTP_SERVER=example.com FTP_USERNAME=test@example.com FTP_PASSWORD=passwordExample" | ||||
|     "build": "ncc build src/main.ts -o dist --watch", | ||||
|     "build-docker": "docker build --tag action .", | ||||
|     "run-docker": "act --workflows ./debug/ --secret username=UserNameHere --secret password=PasswordHere" | ||||
|   }, | ||||
|   "repository": { | ||||
|     "type": "git", | ||||
|  | ||||
							
								
								
									
										17
									
								
								src/main.ts
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								src/main.ts
									
									
									
									
									
								
							| @ -70,11 +70,22 @@ function withDefault(value: string, defaultValue: string) { | ||||
| async function syncFiles(args: IActionArguments) { | ||||
|   try { | ||||
|     await core.group("Uploading files", async () => { | ||||
|       return await exec.exec(`git ftp push --force --auto-init --verbose --syncroot ${args.local_dir} --user ${args.ftp_username} --passwd ${args.ftp_password} ${args.gitFtpArgs} ${args.ftp_server}`); | ||||
|       return await exec.exec( | ||||
|         "git ftp push", | ||||
|         [ | ||||
|           "--force", | ||||
|           "--auto-init", | ||||
|           "--verbose", | ||||
|           `--syncroot=${args.local_dir}`, | ||||
|           `--user=${args.ftp_username}`, | ||||
|           `--passwd=${args.ftp_password}`, | ||||
|           args.gitFtpArgs!, | ||||
|           args.ftp_server! | ||||
|         ] | ||||
|       ); | ||||
|     }); | ||||
|   } | ||||
|   catch (error) { | ||||
|     console.error("⚠️ Failed to upload files"); | ||||
|     core.setFailed(error.message); | ||||
|   } | ||||
| } | ||||
| } | ||||
| @ -25,7 +25,7 @@ export enum gitFTPExitCode { | ||||
|     ErrorWhileDownloading = 5, | ||||
|     UnknownProtocol = 6, | ||||
|     RemoteLocked = 7, | ||||
|     NotAGitProject = 8, | ||||
|     GitRelatedError = 8, | ||||
|     PreFTPPushHookFailed = 9, | ||||
|     LocalFileOperationFailed = 10 | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user