Skip to content

Add release step to cricle ci #84

New issue

Have a question about this project? Sign up for a free account to open an issue and contact its maintainers and the community.

By clicking “Sign up for ”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on ? Sign in to your account

Merged
merged 2 commits into from
Oct 1, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .circleci/config.yml
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,6 +10,42 @@ 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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wee need the branch filtering part as well to do it only for specific branches:
https://.com/codeclimate/shipbot/blob/3506f7ebadb6c3c3635c400e62b75dc4571cb252/lib/shipbot/commands/push_engine.rb

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed that thanks. Done 👍🏼

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