From 57bf3157165c929bb136b3d3fb702adffb344625 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Federico=20Moy=C3=A1?= Date: Thu, 1 Oct 2020 11:02:09 -0300 Subject: [PATCH 1/2] Add release step to cricle ci --- .circleci/config.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3468317..50f5dce 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,6 +10,30 @@ jobs: - run: name: Build command: make image + + release_images: + machine: + docker_layer_caching: true + working_directory: ~/codeclimate/codeclimate-phpcodesniffer + steps: + - checkout + - run: + name: Validate owner + command: | + if [ "$CIRCLE_PROJECT_USERNAME" -ne "codeclimate" ] + then + echo "Skipping release for non-codeclimate branches" + circleci step halt + fi + - run: make image + - run: echo "$GCR_JSON_KEY" | docker login -u _json_key --password-stdin us.gcr.io + - run: + name: Push image to GCR + command: | + docker tag $CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME \ + us.gcr.io/code-climate/codeclimate-phpcodesniffer:b$CIRCLE_BUILD_NUM + docker push us.gcr.io/code-climate/codeclimate-phpcodesniffer:b$CIRCLE_BUILD_NUM + notify: webhooks: - url: https://cc-slack-proxy.herokuapp.com/circle From d880da1a63455d2d0e844b21a10e57ad45668102 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Federico=20Moy=C3=A1?= Date: Thu, 1 Oct 2020 11:19:49 -0300 Subject: [PATCH 2/2] Add filtering to workflow --- .circleci/config.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 50f5dce..848ca2a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -34,6 +34,18 @@ jobs: us.gcr.io/code-climate/codeclimate-phpcodesniffer:b$CIRCLE_BUILD_NUM docker push us.gcr.io/code-climate/codeclimate-phpcodesniffer:b$CIRCLE_BUILD_NUM +workflows: + version: 2 + build_deploy: + jobs: + - build + - release_images: + requires: + - build + filters: + branches: + only: /master|channel\/[\w-]+/ + notify: webhooks: - url: https://cc-slack-proxy.herokuapp.com/circle