gpt4 book ai didi

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

转载 作者:搜寻专家 更新时间:2023-10-31 22:53:50 26 4
gpt4 key购买 nike

我昨天注意到 BitBucket 支持 CICD 管道,这是一个我很想使用的惊人功能。

但是我在设置它时遇到了一些困难。

我的一般构建过程:

  • npm 安装
  • npm 安装-g 凉亭
  • 凉亭安装
  • npm install -g gulp
  • 一饮而尽

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

这转换为以下 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 文件夹,而不是 build 一个在 gulp 步骤中创建的。

有什么想法吗?


更新 --syncroot 似乎是部分修复。这意味着它现在确实会尝试上传 build 目录。然而,此时的问题是 git ftp 似乎只同步跟踪文件。

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

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

.git-ftp-include 文件内容: build/index.html:/src/index.html

这基本上是说:每当 src 中的 index.html 时,从 build syncroot 上传 index.html > 目录已更改。

最佳答案

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

关于node.js - BitBucket 管道 - 使用 node/gulp/git ftp 构建和部署,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45083254/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com