CI doesn't deploy on Heroku using dpl

Summary

CI can't deploy on Heroku using dpl

Steps to reproduce

I have added .gitlab-ci.yml just to my dev branch (not in master), have defined HEROKU_STAGING_API_KEY as an environmental variable and my .gitlab-ci.yml is similar this tutorial: https://docs.gitlab.com/ce/ci/examples/test-and-deploy-python-application-to-heroku.html

Then I push my dev branch into origin.

Example Project

Following is content of my .gitlab-ci.yml:

image: node:9.5
before_script:
  - npm install
  - npm run build
  - apt-get update -y
  - apt-get install rubygems -y
  - gem install dpl

staging:
  script:
    - cd dist
    - dpl --provider=heroku --app=my-app-name --api-key=$HEROKU_STAGING_API_KEY
  only:
    - dev

I haven't installed Gitlab on my system, I do have Linux Mint and git version 2.7.4 I'm using one of shared Runners in GItlab.

What is the current bug behavior?

When I look into job logs, everything works fine until Runner tries to run the command: dpl --provider=heroku --app=syk-cloud-dev --api-key=$HEROKU_STAGING_API_KEY and following is result:

invalid option "--api-key=" ERROR: Job failed: exit code 1

I have simulated this on my local Docker, ran all those commands with same arguments, and dpl successfully deployed on Heroku. This alarms me that there is bug in Gitlab.

What is the expected correct behavior?

Dpl should be able to deploy it successfully on Heroku, same as it does on my local Docker.

Relevant logs and/or screenshots

Following is part of my job log on Gitlab:

$ gem install dpl
Successfully installed dpl-1.8.47
Parsing documentation for dpl-1.8.47
Installing ri documentation for dpl-1.8.47
Done installing documentation for dpl after 1 seconds
1 gem installed
$ cd dist
$ dpl --provider=heroku --app=syk-cloud-dev --api-key=$HEROKU_STAGING_API_KEY
invalid option "--api-key="
ERROR: Job failed: exit code 1

Output of checks

This bug happens on Gitlab. I think so, because these commands work fine on local Docker.