【问题标题】:How to run grunt build in order to deploy the web application with bitbucket pipeline?如何运行 grunt build 以使用 bitbucket 管道部署 Web 应用程序?
【发布时间】:2017-06-14 08:34:10
【问题描述】:

我想在生产模式下生成 Web 应用程序(运行 grunt build),并通过 git ftp 使用 bitbucket 管道从我的虚拟主机上的 dist/ 文件夹中推送生成的文件和文件夹。

Bitbucket 网络应用结构

app[dir]
tests[dir]
.gitignore
Gruntfile.js
bitbucket-pipelines.yml
bower.json
package.json
...

gitignore

/node_modules
/dist
/.tmp
/.sass-cache
/bower_components

# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
Icon?
ehthumbs.db
Thumbs.db
log
node_modules
node

# Personal application yamls #
##############################
*bitbucket-pipelines.yml
src/main/resources/static/js/vendor
application-cat.yml
.tern-project
bitbucket-pipelines.yml
.idea/workspace.xml

bitbucket-pipelines.yml

image: node:4.6.0

pipelines:
  default:
    - step:
      script: 
        - apt-get update
        - apt-get -qq install git-ftp
        - npm install
        - npm install -g grunt-cli
        - npm install -g grunt@0.4.5
        - npm install -g bower
        - bower install  --allow-root
        - grunt build
        - git ftp push --user $FTP_USERNAME --passwd $FTP_PASSWORD ftp://myDomain.com/public_html/folder/

通知

如果我在本地运行“grunt build”,它将在我的根应用程序名称中生成一个文件夹:dist(witch 没问题!!)。 如果我运行 bitbucket.pipelines.yml 脚本(全部成功),它不会生成任何 dist 文件夹(女巫不行!!)。

结论

我最终在我的虚拟主机上推送了所有存储库,因为我无法定位任何 dist 文件夹。有什么建议吗?

【问题讨论】:

  • 我也有同样的问题,你找到解决办法了吗?
  • @Gowri 你好,不......从那时起我还没有寻找其他解决方案......

标签: git deployment gruntjs bitbucket bitbucket-pipelines


【解决方案1】:

我们需要使用 .git-ftp-include 文件来包含未跟踪的文件。如果 grunt build 生成 build 文件夹。然后我们需要在 .git-ftp-include 中添加以下内容,以强制同步过程中的构建文件夹。

!build/

希望对你有帮助

【讨论】:

  • 谢谢先生的回复,我会尽快检查
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2010-10-12
  • 2020-11-20
  • 2017-11-03
  • 2018-07-14
  • 1970-01-01
  • 2020-06-09
  • 1970-01-01
相关资源
最近更新 更多