Build nodejs then send dist folder to Heroku via dlp

My .gitlab-ci.yaml looks like this:

image: node:8.8.1

stages:
  - test
  - build
  - deploy

# test:
#   stage: test
#   script:
#   - echo "Running tests"
#   only:
#   - master

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

deploy_staging:
  type: deploy
  stage: deploy
  image: ruby:latest
  script:
    - apt-get update -y
    - apt-get install rubygems -y
    - gem install dpl
    - cd dist
    - dpl --provider=heroku --app=app-name --api-key=key
  environment:
    name: staging
  only:
  - master

The intention is that it builds everything using a node image, then using a ruby image and dlp I upload the dist folder to heroku.

Initially the /dist folder contains just two files, a package.json and a server.js (required for heroku to detect and serve the app). The expectation is that after the build stage is done, the /dist folder will also contain my built app (index.html and the /static folder).

The /dist folder makes it to heroku but it does not contain the build files (index.html and the /static folder).

Any ideeas?
Thanks!

Hey. 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.

1 Like

Thanks!
I’ll give that a shot.

1 Like