I'm using lftp to automated gitlab ci deployments. I run a script to deploy my code, except 'static' files that I need to upload to other server. Here a sample of my current code.
script:
- >
lftp
-e "mirror
--exclude ^\.git.*
--exclude-glob *.sql
--exclude-glob *.sqlite3
--exclude-glob *.txt
--exclude-glob *.csv
--exclude-glob *.pyc
--exclude settings.py
--exclude migracion/
--exclude static/
--exclude ^Resources/Private/
--exclude \.gitlab-ci.yaml
-eRv $CI_PROJECT_DIR /pro/ject/dirs; quit;"
sftp://$ACC
This works fine but after this, I have to upload by hand the static files to the static files server. Can you help me with a script that only fetch files in all static folders? Static folders can be in root and inside other folders. Many Thx.
You can use :
Where, in mirror :
-e
: remove files that doesn't exist anymore-R
: means you upload from local machine to ftp server-x
: specify a directory to exlude. You can have more than one-x
-p
: parallelize./
: local dir you want uploaddev-site
: remote dir where upload have to go. Take care about the remote dir parameter :dev-site/
), your current dir will be uploaded INSIDE this dir on the ftp serverdev-site
), your current dir will be uploaded AS this dir on the ftp serverIf yout to use this with GitLab CI to upload your static-generated documentation, here is an example
.gitlab-ci.yml
withmkdocs
+lftp
: