diff --git a/.circleci/config.yml b/.circleci/config.yml index 6ed720844..ac24244a1 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,29 @@ jobs: name: Publish Docs command: yarn run docs:publish + docker_publish: + <<: *defaults + steps: + - attach_workspace: + at: ~/repo + - run: + 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: + name: Build and push Docker image + command: | + 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 @@ -136,3 +145,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" + } + ] + ] +}