简体   繁体   中英

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. 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). To check if dist and it's content exist I run the ls command there and it shows me the properly build app structure.

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.

How can we remove this limitation as I don't want to have dist in my repo?

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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