Bitbucket 管道部署忽略 ftp 上传的供应商文件夹

Bitbucket pipeline deploy ignores vendor folder with ftp upload

我正在尝试使用 bitbucket 管道部署 PHP 项目。使用此代码:

init: # -- First time init
  - step:
      name: build
      image: php:7.1.1
      caches:
        - composer
      script:
        - apt-get update && apt-get install -y unzip
        - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
        - composer install
        - vendor/bin/phpunit
      artifacts: # defining vendor/ as an artifact
        - vendor/**
  - step:
      image: samueldebruyn/debian-git
      name: deployment
      script:
        - apt-get update
        - apt-get -qq install git-ftp
        - git ftp init -u "$FTP_DEV_USERNAME" -p "$FTP_DEV_PASSWORD" ftp://$FTP_DEV_HOST/$FTP_DEV_FOLDER

但它忽略了供应商文件夹。我假设,工件也会添加此文件夹进行部署。

哪里出了问题或者我可以做些什么更好?

发生这种情况是因为您可能有一个包含 vendor 目录的 .gitignore。这些工件实际上由 bitbucket 传递到下一步,但被 git-ftp 忽略。为了使用 git-ftp 上传这些文件,您需要创建一个名为 .git-ftp-include 的文件,您需要在其中添加以下行:!vendor/! 是必需的,如 docs 中所述:

The .git-ftp-include file specifies intentionally untracked files that Git-ftp should upload. If you have a file that should always be uploaded, add a line beginning with ! followed by the file's name.