Is there any way to create state file manually ?
First version of my app is already deployed on server. now I want to deploy only updated files. so is there any way to create state file manually or through command ?
By default this action only uploads changed files to the server, unless you have set dangerous-clean-slate to true, so it shouldn't be necessary to create the state file manually or use a command
well, in our case, by default it is trying to update all files on first run. we even tried with explicitly stating dangerous-clean-slate to false (even though false is the default value). we have raised and issue to have option for first run.
I've managed to get current state contents by using PowerShell to list directories and files. Every file detail includes its full name ($_.FullName), its size ($_.Length) and its SHA-256 hash ({ Get-FileHash -Algorithm SHA256 $_ }.Hash):
{
"description": "DO NOT DELETE THIS FILE. This file is used to keep track of which files have been synced in the most recent deployment. If you delete this file a resync will need to be done (which can take a while) - read more: https://github.com/SamKirkland/FTP-Deploy-Action",
"version": "1.0.0",
"generatedTime": 1725909769351,
"data": [
{
"type": "folder",
"name": "subdomains"
},
{
"type": "folder",
"name": "subdomains/my-site"
},
{
"type": "file",
"hash": "49de76e8a055e96a892597482c386828fc181996942959393cf8279cc8026211",
"name": "subdomains/my-site/index.html",
"size": 3537
}
]
}
I've not yet tested a new deploy on it because I'm exploring the way to get repository tag containing version number to be set as the version value in state file.
I've written a small script for this: https://gist.github.com/mifka01/4b4f1175c5f58ca8c437770371652367 It's not tested enought tho.