微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

node.js – BitBucket管道 – 使用node / gulp / git ftp构建和部署

昨天我注意到BitBucket支持CICD管道,这是我渴望使用的一个了不起的功能.

但是我设置起来有些困难.

我的建设过程一般:

> npm安装
> npm install -g bower
>凉亭安装
> npm install -g gulp
> gulp

gulp命令正在构建HTML应用程序并将输出放置到构建文件夹.构建完成后,我希望将代码转移到我网站上的目录中.

这转换为以下bitbucket.yml:

# This is a sample build configuration for JavaScript.
# Check our guides at https://confluence.atlassian.com/x/14UWN for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: node:6.9.4

pipelines:
  default:
    - step:
        caches:
          - node
        script: # Modify the commands below to build your repository.
          - npm install
          - npm install -g bower
          - bower install --allow-root
          - npm install -g gulp
          - gulp
          - cd build
          - apt-get update
          - apt-get -qq install git-ftp
          - git ftp init --user $FTP_USERNAME --passwd $FTP_PASSWORD ftp://mywebsite.com/public_html/mydirectory

我得到的问题是git ftp init似乎是上传src文件夹,而不是在gulp步骤中创建的构建内容.

有任何想法吗?

更新:–syncroot似乎是一个部分修复.这意味着它现在尝试上传构建目录.但是,此时的问题是git ftp似乎只是同步跟踪文件.

因为构建文件夹中的文件是在管道构建期间创建的,所以不适用于这些文件.

我试图添加一个名为.git-ftp-include的文件,如上所述应该传输未跟踪的文件.遗憾的是,我没有成功部署我的代码.

.git-ftp-include文件内容
    建立/ index.html的:/src/index.html

基本上说:每当src目录中的index.html发生更改时,都会从构建同步根中上传index.html.

解决方法

对于要通过git-ftp传输的未跟踪文件,.git-ftp-include中的语法为 !filename.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐