From d14e768c5689c9b245397126750216f7d2790bba Mon Sep 17 00:00:00 2001 From: maxjeffos <44034094+maxjeffos@users.noreply.github.com> Date: Sat, 22 May 2021 14:47:54 -0400 Subject: [PATCH] chore: refactor publish --- .circleci/config.yml | 33 ++------------------------------- scripts/ci-deploy-prod.sh | 21 +++++++++++++++++++-- 2 files changed, 21 insertions(+), 33 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 67a453a6..9357a0b9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -85,7 +85,7 @@ jobs: command: | node ./ops/deploy/dist/run-test-pipelines.js - build_prod: + deploy_prod: docker: - image: circleci/node:lts environment: @@ -117,27 +117,6 @@ jobs: - store_artifacts: path: ./Snyk-snyk-security-scan.vsix - - - persist_to_workspace: - root: . - paths: - - ./Snyk-snyk-security-scan.vsix - - publish: - docker: - - image: circleci/node:lts - environment: - AZ_EXTENSION_ID: "snyk-security-scan" - AZ_EXTENSION_NAME: "Snyk Security Scan" - AZ_PUBLISHER: "Snyk" - working_directory: ~/repo - steps: - - attach_workspace: - at: ~/repo - - run: - name: Publish to Marketplace - command: | - tfx extension publish --token $AZURE_DEVOPS_EXT_PAT --vsix Snyk-snyk-security-scan.vsix workflows: version: 2 @@ -150,18 +129,10 @@ workflows: filters: branches: ignore: master - - build_prod: + - deploy_prod: context: nodejs-lib-release requires: - test filters: branches: only: master - - hold: - type: approval - requires: - - build_prod - - publish: - context: nodejs-lib-release - requires: - - hold diff --git a/scripts/ci-deploy-prod.sh b/scripts/ci-deploy-prod.sh index d4706985..60655e73 100755 --- a/scripts/ci-deploy-prod.sh +++ b/scripts/ci-deploy-prod.sh @@ -23,10 +23,27 @@ tfx extension create \ --token $AZURE_DEVOPS_EXT_PAT \ --output-path Snyk-snyk-security-scan.vsix +create_exit_code=$? +if [[ create_exit_code -eq 0 ]]; then + echo "Extension created" + ls -la +else + echo "Failed to create extension with exit code ${create_exit_code}" + exit ${create_exit_code} +fi + +if [[ ! -f "Snyk-snyk-security-scan.vsix" ]]; then + echo "missing Snyk-snyk-security-scan.vsix file, not publishing extension" + exit 1 +fi + +echo "Snyk-snyk-security-scan.vsix file exists, publishing extension..." +tfx extension publish --token $AZURE_DEVOPS_EXT_PAT --vsix Snyk-snyk-security-scan.vsix + publish_exit_code=$? if [[ publish_exit_code -eq 0 ]]; then - echo "Extension created" + echo "Extension published" else - echo "Extension failed to create extension with exit code ${publish_exit_code}" + echo "Failed to publish extension with exit code ${publish_exit_code}" exit ${publish_exit_code} fi