CircleCI + Gradle + Heroku部署

问题描述 投票:1回答:1

我正在尝试使用Gradle和Heroku进行持续部署,但由于某种原因,部署步骤未运行。

CircleCI Pipeline result enter image description here 我已经用Heroku键更新了圆圈ci。

version: 2
jobs:
  build:
    docker:
      - image: circleci/openjdk:8-jdk

    working_directory: ~/repo

    environment:
      JVM_OPTS: -Xmx3200m
      TERM: dumb

    steps:
      - checkout

      - restore_cache:
          keys:
          - v1-dependencies-{{ checksum "build.gradle" }}
          - v1-dependencies-

      - run: gradle dependencies

      - save_cache:
          paths:
            - ~/.m2
          key: v1-dependencies-{{ checksum "build.gradle" }}

      # run tests!
      - run: gradle test
deployment:
  staging:
    branch: master

    heroku:
      appname: my-heroku-app

你能帮助我吗?部署步骤是否在正确的位置?

java heroku gradle circleci
1个回答
0
投票

您正在使用CircleCI 1.0的部署配置,但您使用的是CircleCI 2.0

从CircleCI 2.0的文档:

通过CircleCI UI的内置Heroku集成未针对CircleCI 2.0实现。但是,可以手动部署到Heroku。

要使用CircleCI 2.0在heroku上部署,您需要:

  1. 将环境变量HEROKU_LOGIN,HEROKU_API_KEY,HEROKU_APP_NAME添加到您的CircleCI项目设置https://circleci.com/gh/<account>/<project>/edit#env-vars
  2. 创建一个没有密码的私有ssh密钥,并将其添加到您的CircleCI项目设置https://circleci.com/gh/https://circleci.com/gh/<account>/<project>/edit#ssh for hostname git.heroku.com
  3. 使用ssh密钥的指纹在.circleci / config.yml文件中添加步骤
  - run:
      name: Setup Heroku
      command: |  
        ssh-keyscan -H heroku.com >> ~/.ssh/known_hosts
        cat > ~/.netrc << EOF
        machine api.heroku.com
          login $HEROKU_LOGIN
          password $HEROKU_API_KEY
        EOF
        cat >> ~/.ssh/config << EOF
        VerifyHostKeyDNS yes
        StrictHostKeyChecking no
        EOF
  - add_ssh_keys:
      fingerprints:
        - "<SSH KEY fingerprint>"
  - deploy:
      name: "Deploy to Heroku"
      command: git push --force [email protected]:$HEROKU_APP_NAME.git HEAD:refs/heads/master
© www.soinside.com 2019 - 2024. All rights reserved.