From 5feb29422c80769e98d25e6db1ee041a90f9f87f Mon Sep 17 00:00:00 2001 From: dannyrb Date: Tue, 21 May 2019 12:53:15 -0400 Subject: [PATCH 1/4] Try using latest version to bump docker image tag --- .circleci/config.yml | 34 +++++++++++++++++++--------------- .releaserc | 14 ++++++++++++++ 2 files changed, 33 insertions(+), 15 deletions(-) create mode 100644 .releaserc diff --git a/.circleci/config.yml b/.circleci/config.yml index 6ed720844..2b642cd6a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -70,21 +70,7 @@ jobs: # attempting to run it from a `pr`, which is not the case - run: name: Publish using Semantic Release - command: npx semantic-release --debug --dry-run - - docker_publish: - <<: *defaults - steps: - - attach_workspace: - at: ~/repo - - setup_remote_docker: - docker_layer_caching: true - - run: - name: Build and push Docker image - command: | - docker build -t ohif/$IMAGE_NAME:$TAG . - echo $DOCKER_PWD | docker login -u $DOCKER_LOGIN --password-stdin - docker push ohif/$IMAGE_NAME:$TAG + command: npx semantic-release --debug docs_publish: <<: *defaults @@ -106,6 +92,23 @@ jobs: name: Publish Docs command: yarn run docs:publish + docker_publish: + <<: *defaults + steps: + - attach_workspace: + at: ~/repo + - run: + name: Skip if no new version + command: [ ! -e /tmp/updated-version ] || exit 1 + - setup_remote_docker: + docker_layer_caching: true + - run: + name: Build and push Docker image + command: | + docker build -t ohif/$IMAGE_NAME:{{ checksum "/tmp/updated-version" }}.${CIRCLE_BUILD_NUM} . + echo $DOCKER_PWD | docker login -u $DOCKER_LOGIN --password-stdin + docker push ohif/$IMAGE_NAME:{{ checksum "/tmp/updated-version" }}.${CIRCLE_BUILD_NUM} + workflows: version: 2 @@ -136,3 +139,4 @@ workflows: - docker_publish: requires: - build_and_test + - npm_publish diff --git a/.releaserc b/.releaserc new file mode 100644 index 000000000..075e85fb5 --- /dev/null +++ b/.releaserc @@ -0,0 +1,14 @@ +{ + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + "@semantic-release/npm", + "@semantic-release/github", + [ + "@semantic-release/exec", + { + "publishCmd": "echo ${nextRelease.version} > /tmp/updated-version" + } + ] + ] +} From fdd74421cca30aa035ccfce31373373a99e92893 Mon Sep 17 00:00:00 2001 From: dannyrb Date: Tue, 21 May 2019 12:55:50 -0400 Subject: [PATCH 2/4] Push latest tag as well --- .circleci/config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2b642cd6a..924d01f52 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -105,9 +105,10 @@ jobs: - run: name: Build and push Docker image command: | - docker build -t ohif/$IMAGE_NAME:{{ checksum "/tmp/updated-version" }}.${CIRCLE_BUILD_NUM} . + docker build -t ohif/$IMAGE_NAME:{{ checksum "/tmp/updated-version" }}.${CIRCLE_BUILD_NUM} ohif/$IMAGE_NAME:latest . echo $DOCKER_PWD | docker login -u $DOCKER_LOGIN --password-stdin docker push ohif/$IMAGE_NAME:{{ checksum "/tmp/updated-version" }}.${CIRCLE_BUILD_NUM} + docker push ohif/$IMAGE_NAME:latest workflows: version: 2 From 8cc9e5b485176aa10a3db98ad8df66a889454362 Mon Sep 17 00:00:00 2001 From: dannyrb Date: Tue, 21 May 2019 12:59:25 -0400 Subject: [PATCH 3/4] Expand to multiple lines --- .circleci/config.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 924d01f52..4fe431c85 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -98,8 +98,13 @@ jobs: - attach_workspace: at: ~/repo - run: - name: Skip if no new version - command: [ ! -e /tmp/updated-version ] || exit 1 + name: Skip if no new NPM version was released + command: | + # + # + if [[ ! -e /tmp/updated-version ]]; then + exit 1 + fi - setup_remote_docker: docker_layer_caching: true - run: From e94a01a3e9b97b8a01a04bd6e3653268458b290e Mon Sep 17 00:00:00 2001 From: dannyrb Date: Tue, 21 May 2019 13:00:03 -0400 Subject: [PATCH 4/4] formatting --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4fe431c85..ac24244a1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -92,7 +92,7 @@ jobs: name: Publish Docs command: yarn run docs:publish - docker_publish: + docker_publish: <<: *defaults steps: - attach_workspace: