Bitbucket Pipelines:从子目录上传到登台/生产服务器

Bitbucket Piplines: Upload from a sub directory to staging / production server

我正在尝试使用 bitbucket's pipeline 服务上传我的项目并且它工作正常。但是,我只需要从特定的子目录上传文件。

我的目录结构如下:

Repository:
  - Appz
    - Android
    - iOS
  - Designs
    - Appz
    - Web
  - Web
    - Html
    - Laravel

我只需要从 Repository / Web 上传文件(而不是从任何其他目录)。但是 pipeline 服务正在将整个存储库上传到服务器。

bitbucket-pipelines.yml

image: php:7.2

pipelines:
  branches:
    master:
      - step:
          script:
            - apt-get update && apt-get install -y unzip git-ftp
            - export PROJECT_NAME=Web/
            - git-ftp init --user $FTP_USERNAME --passwd $FTP_PASSWORD ftp://domain/path

我找到了解决办法。唯一需要修改的命令是 git-ftp 命令。但是,我也发现export命令在这里没有任何作用,所以我删除了它,命令仍然按照我的要求工作。

情况如下:

- apt-get update && apt-get install -y unzip git-ftp
- git-ftp init --syncroot Web --user $FTP_USERNAME --passwd $FTP_PASSWORD ftp://domain/path

只需指定 --syncroot <PATH/TO/DIRECTORY> 参数即可设置 pipeline 服务需要从中获取和上传文件的所需源位置。

希望对您有所帮助。
谢谢。