CI使用Gitlab和Heroku

我正在使用react-starter-kit来开发我的web应用程序,并使用Gitlab作为我的远程git存储库。
我想configuration一个连续的部署,以便在每次向主服务器推送时,都会执行npm run deploy脚本。

从我的本地电脑执行npm run deploy构build节点应用程序并将其推送到远程的heroku git存储库。 它使用我的电脑本地凭据。

我已经configuration了gitlab runner(在.yml文件中)来执行相同的npm run deploy ,但是失败并显示Error: fatal: could not read Username for 'https://git.heroku.com': No such device or address 。 我需要find一种方法来validationgitlab亚军heroku。 我试图设置variablesHEROKU_API_KEY ,但它也没有工作。

我怎么能从我的gitlab亚军推到我的heroku git回购?

你应该在你的yml中使用dlp 。 在.gitlab-ci.yml试试这样的东西:

 before_script: - apt-get -qq update - npm set progress=false - npm install --silent deploy: script: - npm run deploy - apt-get install -yqq ruby ruby-dev --silent - gem install dpl - dpl --provider=heroku --app=your-app-name --api-key=$HEROKU_API_KEY only: - master 

你最好想从GitLab添加envvariables$ HEROKU_API_KEY,而不是直接在这里。

请参阅@Polymath先生回答一个更正:
--api key=$HEROKU_API_KEY应该读取--api-key=$HEROKU_API_KEY

请参阅DPL文档