An example circle.yml for building a docker image and running behave in it. On every tag push from github (a Release), this will attempt to push to Google Container Registry.

Important note: AFAIK you need administrative permissions on Google Container and Google Storage when creating the service key. Find more info on getting the service account from Google into the CircleCI environment variables here: Authentication with Google Cloud Platform - CircleCI.

Note the regex watches for a tag like v0.1

machine:
  python:
    version: 3.4.2
  services:
    - docker
  node:
    version: 4.2.6
  environment:
    PROJECT_NAME: project
    CLUSTER_NAME: cluster-01
    CLOUDSDK_COMPUTE_ZONE: europe-west1-b

checkout:
  post:
    - git submodule init
    - git submodule update


dependencies:
  override:
    - docker info
    - docker build --rm=true -t circleci/api:$CIRCLE_SHA1 -f Dockerfile .

test:
  override:
    - docker run -i --env APP_ENV=circle --env RUN_BEHAVE=true circleci/api:$CIRCLE_SHA1

deployment:
  release:
    tag: /v[0-9]+(\.[0-9]+)*/
    owner: Zowie
    commands:
      - sudo /opt/google-cloud-sdk/bin/gcloud --quiet components update --version 120.0.0
      - sudo /opt/google-cloud-sdk/bin/gcloud --quiet components update --version 120.0.0 kubectl
      - echo $GCLOUD_SERVICE_KEY | base64 --decode -i > ${HOME}/gcloud-service-key.json
      - sudo /opt/google-cloud-sdk/bin/gcloud auth activate-service-account --key-file ${HOME}/gcloud-service-key.json
      - sudo /opt/google-cloud-sdk/bin/gcloud config set project $PROJECT_NAME
      - sudo /opt/google-cloud-sdk/bin/gcloud --quiet config set container/cluster $CLUSTER_NAME
      - sudo /opt/google-cloud-sdk/bin/gcloud config set compute/zone ${CLOUDSDK_COMPUTE_ZONE}
      - sudo /opt/google-cloud-sdk/bin/gcloud --quiet container clusters get-credentials $CLUSTER_NAME
      - docker tag circleci/api:$CIRCLE_SHA1 eu.gcr.io/${PROJECT_NAME}/api:$CIRCLE_TAG
      - sudo /opt/google-cloud-sdk/bin/gcloud docker push eu.gcr.io/${PROJECT_NAME}/api:$CIRCLE_TAG