vscode-deploy-reloaded icon indicating copy to clipboard operation
vscode-deploy-reloaded copied to clipboard

Best way to deploy different folders to different targets

Open bavarianbytes opened this issue 5 years ago • 3 comments

/folder-a/
   /subfolder-a/
/folder-b/
   /subfolder-b/

Is there a way to deploy folder a and subfolders to target a and folder b and subfolders to target b without being asked to which target i want to deploy?

bavarianbytes avatar Mar 05 '20 09:03 bavarianbytes

When you make a package, you choose an array of files to include in that package. You can simply make two packages, one for folder A and one for folder B, with different targets. I’m assuming here you want to deploy on save (or change) – I presume it should work if you want to deploy manually as well (though I rarely use that feature, so I’m not a hundred per cent sure there):

"deploy.reloaded": {
	"packages": [
		{
			"name": "Deploy folder A",
			"files": [
				"folder-a/**/*.*"
			],
			"deployOnSave": [ "Folder A Target" ]
		},

		{
			"name": "Deploy folder B",
			"files": [
				"folder-b/**/*.*"
			],
			"deployOnSave": [ "Folder B Target" ]
		}
	],

	"targets": [
		{
			"type": "ftp", // or whatever type you want to use
			"name": "Folder A Target",
			"dir": "/target-a/"
			// add rest of target settings here
		},
		{
			"type": "ftp", // or whatever type you want to use
			"name": "Folder B Target",
			"dir": "/target-b/"
			// add rest of target settings here
		}
	],
}

kokoshneta avatar Feb 02 '21 11:02 kokoshneta

Doesn't work for me. I tried it for deploying manually. If i deploy a file or folder (via shortcut, button or context menu) it always asks me to which target i want to deploy. I tried that config:

		"packages": [
			{
				"name": "customer1",
				"deployOnSave": false,
				"files": [
					"/customer1folder/**/*"
				],
				"targets": ["target1"]
			},
			{
				"name": "customer2",
				"deployOnSave": false,
				"files": [
					"/customer2folder/**/*"
				],
				"targets": ["target2"]
			}
		],
		"targets": [
			{
				"name": "target1",
				"type": "sftp",
				"host": "***",
				"port": 22,
				"user": "***",
				"password": "***",
				"dir": "/htdocs",
				"mappings": {
					"/customer1folder/**/*": "/htdocs"
				}
			},
			{
				"name": "target2",
				"type": "sftp",
				"host": "***",
				"port": 22,
				"user": "***",
				"password": "***",
				"dir": "/htdocs",
				"mappings": {
					"/customer2folder/**/*": "/htdocs"
				}
			}
                ],

bavarianbytes avatar Mar 04 '21 13:03 bavarianbytes

Doesn't work for me. I tried it for deploying manually. If i deploy a file or folder (via shortcut, button or context menu) it always asks me to which target i want to deploy.

I’ve been deploying more files manually recently than I used to, and this is what I find as well. It seems when you manually deploy, it will always ask where to deploy to; the targets you set up in your settings.json are only used when the deploy action is invoked by an event listener.

I don’t see anything on the wiki that looks like it might apply to manual invocation, so it looks like this may not be possible currently.

kokoshneta avatar Mar 04 '21 14:03 kokoshneta