简体   繁体   English

Travis无法部署dist文件夹

[英]Travis not able to deploy dist folder

I'm trying to deploy our app through travis cli, the build is getting build perfectly, but when it comes to deploy, it deploys the whole root app folder. 我正在尝试通过travis cli部署我们的应用程序,该构建正在完美构建,但是在部署时,它将部署整个根应用程序文件夹。 What I want is to deploy the dist folder generated by the build, so when I do cd dist before_deploy, it deploys nothing(I check on aws bucket and the travis.zip file comes to be 22 Bytes). 我想要的是部署由构建生成的dist文件夹,所以当我执行cd dist before_deploy时,它什么都不会部署(我检查aws bucket,travis.zip文件变为22字节)。 To check if dist and it's content exist I run the ls command there and it shows me the properly build app structure. 要检查dist及其内容是否存在,我在此处运行ls命令,它向我展示了正确构建的应用程序结构。

For testing I tried cding into different folder and deploying, and in all the cases, travis is able to deploy it but it's not able to deploy the directories which are under gitignore, dist being one of them. 为了进行测试,我尝试将cding放入不同的文件夹并进行部署,在所有情况下,travis都可以部署它,但是它无法部署gitignore下的目录,dist是其中之一。

How can we remove this limitation as I don't want to have dist in my repo? 我不想在回购中加入dist,我们如何才能消除此限制?

Here is my code 这是我的代码

language: node_js
node_js:
- 8.9.4
cache:
  directories:
  - node_modules
before _script:
- npm install
script:
  - npm run build-staging
  - gulp copy-package
  - if [ "$TRAVIS_BRANCH" = "prod" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ]; then npm run build-prod; else echo "PR skip deploy"; fi
before_deploy:
  - ls
  - cd $TRAVIS_BUILD_DIR/node_modules
  - ls
deploy:
  - provider: elasticbeanstalk
    access_key_id: access_id
    secret_access_key:
      secure: secret_key
    region: eu-west-1
    app: yop-v3
    env: yop-staging-test
    bucket_name: elasticbeanstalk-eu-west-1-123456789
    skip_cleanup: true
    on:
      repo: company/repo-name
      branch: travis2
after_deploy:
  - ls

You need to specify local_dir which you want to deploy (In this case dist ) like this 您需要像这样指定要部署的local_dir (在这种情况下为dist

deploy:
  - provider: elasticbeanstalk
    access_key_id: access_id
    secret_access_key:
      secure: secret_key
    region: eu-west-1
    local_dir: dist        //here       
    app: yop-v3
    env: yop-staging-test
    bucket_name: elasticbeanstalk-eu-west-1-123456789
    skip_cleanup: true
    on:
      repo: company/repo-name
      branch: travis2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM