travis-ci中的Yeoman项目未能将dist目录部署到S3

时间:2015-12-09 16:07:41

标签: amazon-s3 gruntjs yeoman travis-ci yeoman-generator

我有一个yeoman项目(webapp生成器),以及以下travis-ci配置:

language: node_js  
node_js:
- '4.1'
before_script:
- gem install compass
- npm install
- npm install bower
- bower install
- npm install grunt-cli
- grunt build
deploy:
  provider: s3
  access_key_id: AKIAIOVIOPLVOEVHJUQA
secret_access_key:
secure: HhLo08go5z+PBZkimdgLoTBBXQPzw0B1P2WHWmqtZ/H9RzGc7IUFE/6ubnewlyqy6Baa3mumcQ2A24lm98/ZZt8GZ+usI8dDF9maGVCFq2R53G1Rir+HleDVtkm/xGrxpvtLn/x+4QNselt2F6oODGNpmgGumaqMiabMm59ABw4CV3TULvWz1CKg/BC/YTVz58Equ0MhIZIk6igjc1PgOEiXfsKlBGVI5///MqjsuYB/6dtlrhzxPSpdGucnU0lmW+0TDzkX9WyEJPeDjTVLYNiviZmKIPw0fofc3BGCZs6QEibAFkJ40JF8CCzC3JdcV0vj7PFe5LEtWd+LGW+gew5HjVGcPkOtGwi8npTmHOlTZJRgrFySdJe6fy8N3we2Ht194GqPnJx8/D/F0p1fNq8/KujxQZX6L5BJNfO5a9iYgyD3q/cWBbxj2VIbYkrZAKK8LtnXrzXY+owmQYLiENB47atiwtJBg2ZoSsBw8ANR1RWSlyymdbwvoBxKUoZ324MO2l3yrAndheS1S4hauRs6bk52obcPUKMFkW+1/sDbxf15JcMhi48RN1jcDGSpHKqm7zHlfd2BfJC3U+tCRchD0gLYmgZBNhsL4sVyil4/0/lWALm10En1eDD8tvssCadnRRllbVIqIyx3UcKJC+JwymvtUatwHBW61ZzQyfA=
    bucket: www.raeprojects.org
    local-dir: dist
    acl: public_read
    on:
      repo: raeprojects/www-raeprojects-org

我正在尝试将dist目录(由grunt build任务创建)部署到S3。除了在部署阶段,travis ci无法找到dist目录并返回此错误消息:

Deploying application
Already up-to-date!
# HEAD detached at 114e66f
nothing to commit, working directory clean
Dropped refs/stash@{0} (7986ed431f2b3467e1369af81ef95256d352c571)
/home/travis/.rvm/gems/ruby-1.9.3-p551/gems/dpl-        1.8.11/lib/dpl/provider/s3.rb:47:in `chdir': No such file or directory - dist (Errno::ENOENT)
    from /home/travis/.rvm/gems/ruby-1.9.3-p551/gems/dpl-1.8.11/lib/dpl/provider/s3.rb:47:in `push_app'
    from /home/travis/.rvm/gems/ruby-1.9.3-p551/gems/dpl-1.8.11/lib/dpl/provider.rb:145:in `block in deploy'
    from /home/travis/.rvm/gems/ruby-1.9.3-p551/gems/dpl-1.8.11/lib/dpl/cli.rb:41:in `fold'
    from /home/travis/.rvm/gems/ruby-1.9.3-p551/gems/dpl-1.8.11/lib/dpl/provider.rb:145:in `deploy'
    from /home/travis/.rvm/gems/ruby-1.9.3-p551/gems/dpl-1.8.11/lib/dpl/provider/s3.rb:73:in `deploy'
    from /home/travis/.rvm/gems/ruby-1.9.3-p551/gems/dpl-1.8.11/lib/dpl/cli.rb:32:in `run'
    from /home/travis/.rvm/gems/ruby-1.9.3-p551/gems/dpl-1.8.11/lib/dpl/cli.rb:7:in `run'
    from /home/travis/.rvm/gems/ruby-1.9.3-p551/gems/dpl-1.8.11/bin/dpl:5:in `<top (required)>'
    from /home/travis/.rvm/gems/ruby-1.9.3-p551/bin/dpl:23:in `load'
    from /home/travis/.rvm/gems/ruby-1.9.3-p551/bin/dpl:23:in `<main>'

无法部署

我对gulp-webapp生成器生成的不同项目也有同样的问题。这是该项目的.travis.yml的spinet:

 . . . . . . 
 before_script:
 - npm install
 - npm install -g bower
 - bower install
 - gulp build
 . . . . . . . 

有人可以帮忙吗?

1 个答案:

答案 0 :(得分:7)

最后我发现travis-ci默认在运行dist/后清除工作区(删除npm test目录)。我找到了一个选项来指示travis-ci no清理工作区。我将skip_cleanup: true添加到.travis.yml并且工作正常。这是我编辑的.travis.yml文件:

deploy:
   . . . . . . .
  bucket: www.raeprojects.org
  local-dir: dist 
  skip_cleanup: true  // insures dist/ dir not to be deleted after npm test
  acl: public_read
  . . . . .