shellgithubgithub-actionslftp

Can't mirror files via lftp in github actions


I am currently working on a GitHub Action to upload changed files onto a server via sftp. For this I have set up a shell script in a docker container. Everything up until the upload works, it connects to the server but errors out on the lftp command, the error beeing mirror: Access failed: /home/username_here/test: No such file or directory. The lftp command from the shell file is lftp -d -c "set ftp:ssl-allow no; open -u $SFTP_USER,placeholder -e 'mirror -R --delete --only-newer --exclude-glob .git/ --exclude-glob .github/ -P1 --parallel=10 -x changed_files.txt $REMOTE_PATH' $SFTP_HOST". SFTP_USER is set to the username, $REMOTE_PATH is set to '/home/username/test/' and SFTP_HOST is set to the ip of the target server. These are all set via the workflow.yml file.

I have tried setting the path to different stuff, but it seems that it tries to move stuff into the directory of the runner? When I change it to a relativ directory, it show the error mirror: Access failed: /github/workspace/test: No such file or directory


Solution

  • So I have gotten it to work. I am now changing directory into the target directory via the lftp command, so the command now is lftp -d -c "set ftp:ssl-allow no; open -u $SFTP_USER,placeholder -e 'cd $REMOTE_PATH; mirror -R --delete --only-newer --exclude-glob .git/ --exclude-glob .github/ -P1 --parallel=10 -x changed_files.txt .' $SFTP_HOST"