From 520b125ac113bf5fc5a622ae06c8c573a8c655af Mon Sep 17 00:00:00 2001 From: Slawomir Koszewski Date: Wed, 25 Feb 2026 21:42:39 +0100 Subject: [PATCH] refactor: simplify publish script by removing positional arguments and improving VSIX path handling --- scripts/publish.sh | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/scripts/publish.sh b/scripts/publish.sh index 83717d8..6a06dff 100755 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -1,26 +1,26 @@ #!/usr/bin/env bash set -euo pipefail -if [[ $# -lt 3 ]]; then - echo "Usage: $0 [org2] [org3] ..." - echo "Requires environment variable AZDO_PAT to be set." - exit 1 -fi +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +set -a +source "$SCRIPT_DIR/.env" +set +a if [[ -z "${AZDO_PAT:-}" ]]; then echo "AZDO_PAT is not set." exit 1 fi -VSIX_PATH="$1" -PUBLISHER_ID="$2" -shift 2 +VSIX_PATH="$SCRIPT_DIR/build/${PUBLISHER_ID}.${EXTENSION_ID}-${EXTENSION_VERSION}.vsix" -for ORG in "$@"; do - echo "Publishing to organization: $ORG" - npx tfx-cli extension publish \ - --vsix "$VSIX_PATH" \ - --publisher "$PUBLISHER_ID" \ - --token "$AZDO_PAT" \ - --share-with "$ORG" -done +if [[ ! -f "$VSIX_PATH" ]]; then + echo "VSIX file not found at path: $VSIX_PATH" + exit 1 +fi + +echo "Publishing to organization: $ORG" +tfx extension publish \ + --vsix "$VSIX_PATH" \ + --publisher "$PUBLISHER_ID" \ + --token "$AZDO_PAT" \ + --share-with "$ORG"