1

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

Bitbucket Web 应用程序结构

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

结论

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

4

1 回答 1

3

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

!build/

希望它会有所帮助

于 2017-11-08T15:27:45.283 回答