如何运行 grunt 构建以便使用 bitbucket 管道部署 Web 应用程序



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

Bitbucket Web 应用程序结构

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

吉特诺

/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(女巫没问题!!如果我运行 bitbucket.pipelines.yml 脚本(全部成功),它不会生成任何 dist 文件夹(女巫是不行的!!

结论

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

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

!build/

希望会有所帮助

最新更新