简体   繁体   中英

Deploy react.js app /dist folder to heroku from gitlab

Im tryig to deploy my dist folder of a project from gitlab to heroku, gitlab ci:

image: node:8.10.0-alpine
cache:
  key: "alpine"
  paths:
    - node_modules/

stages:
  - build
  - production

build:
  stage: build
  artifacts:
    paths:
      - dist/
  script:
    - npm install
    - npm run build
  tags:
    - docker
  only:
    - master

production:
  type: deploy
  stage: production
  image: ruby:latest
  script:
    - apt-get update -qy
    - apt-get install -y ruby-dev
    - gem install dpl
    - cd dist
    - dpl --provider=heroku --app=app --api-key=api-key
  only:
    - master

when the process runs i get: sh: 0: getcwd() failed: No such file or directory fatal: Unable to read current working directory: No such file or directory deploy failed, build exited with code 1 ERROR: Job failed: exit code 1

I solved this issue adding --skip_cleanup to the end of dpl command.

There was a "git stash --all"happening before the deploy.

Example:

dpl --provider=heroku --app=your-app-name --api-key=$HEROKU_API_KEY --skip_cleanup

Hope it helps.

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