git-ftp is ignoring artifacts from Bitbucket pipelines build
Hi, I am doing Bitbucket pipelines build with following settings: pipelines:
default:
- step:
name: Build and test JS.
image: node:8.9.3
script:
- npm install
- npm test
- npm run-script build
- step:
name: Build and test PHP.
image: php:7-fpm
script:
- echo "Here will be the Composer build and PHPUnit tests."
branches:
production:
- step:
name: Build and test JS.
image: node:8.9.3
script:
- npm install
- npm test
- npm run-script build
- ls
- ls public_html
artifacts:
- public_html/**
- step:
name: Build and test PHP.
image: php:7-fpm
script:
- echo "Here will be the Composer build and PHPUnit tests."
- ls
- ls public_html
artifacts:
- public_html/**
- step:
name: Deploy to FTP.
image: samueldebruyn/debian-git
script:
- apt-get update
- apt-get -qq install git-ftp
- ls
- ls public_html
- git ftp push --user $FTP_USERNAME --passwd $FTP_PASSWORD ftp://$FTP_HOST
ls public_html shows me js, css files and index.html after webpack build, but that files are ignored by git-ftp even when I use .git-ftp-include.
How can I do it? Please for help.
I am facing the same issue...
Have you set which git untracked assets are to be transferred using the .git-ftp-include file?
If you're also using apt-get to install git-ftp in Pipelines: I also found that the version of git-ftp that apt-get installed was an older version and required using an older syntax for the .git-ftp-include file, basically no wildcards.
As I posted in this Github thread, while git-ftp is designed to only deploy tracked file changes, it is actually possible to deploy your entire dist folder on every commit, even if these files are untracked.
You first need to create a file called .git-ftp-include in the root of your repo, and add a single line with the path to your dist folder, ensuring you add ! to the start of the line:
!.vuepress/dist/
You should (in theory) be able to then run git ftp push but for some reason this doesn't always upload the dist folder. I needed to run git ftp push --all which uploads ALL your files (even unchanged ones).
The thread mentioned by Simon #46 is a good source for this problem.
I’s recommend setting up a syncroot and because the syncroot might not be tracked by git (maybe it’s in your .gitignore file) you should add it to .git-ftp-include, as Simon mentioned. to make sure it is uploaded.
So in the end you could have something like this:
content of .git-ftp-iunclude:
!dist/
Your command:
git ftp push --user $FTP_USERNAME --passwd $FTP_PASSWORD --syncroot dist/ ftp://$FTP_HOST
But be aware that you will not use the advantages of git with this anymore. The complete folder is uploaded with this every time. Maybe another tool could be better in this case, for example scpor rsync.