From cd6f72d5d68fd066f464d312cd6b18de4390c017 Mon Sep 17 00:00:00 2001 From: FacuBar Date: Thu, 27 Nov 2025 17:25:19 -0300 Subject: [PATCH 1/6] add script to update version everywhere necessary and pipeline with publish command --- .github/workflows/publish.yml | 59 +++++++++++++++++ ai-code-review/package.json | 2 +- ai-code-review/task.json | 3 +- package.json | 2 +- scripts/rev_version.sh | 115 ++++++++++++++++++++++++++++++++++ vss-extension.json | 107 +++++++++++++++++-------------- 6 files changed, 238 insertions(+), 50 deletions(-) create mode 100644 .github/workflows/publish.yml create mode 100755 scripts/rev_version.sh diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..2bb2a7b --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,59 @@ +name: Publish Azure DevOps Extension to Marketplace + +on: + # INFO: Ideally this should also trigger from push to tagged version branch + workflow_dispatch: + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v6 + + - name: Set up Node.js + uses: actions/setup-node@v6 + with: + node-version: "20" + cache: npm + cache-dependency-path: ai-code-review/package-lock.json + + - name: Install dependencies + working-directory: ./ai-code-review + run: npm ci + + - name: Build + working-directory: ./ai-code-review + run: npm run build + + - name: Install tfx-cli + run: npm install -g tfx-cli + + - name: Get extension version + id: get_extension_version + run: | + VERSION=$(node -p "require('./vss-extension.json').version") + echo "Extension version is $VERSION" + echo "version=$VERSION" >> $GITHUB_OUTPUT + + - name: Create extension package (.vsix) + run: tfx extension create + + - name: Publish extension to Azure DevOps Marketplace + run: tfx extension publish -t ${{ secrets.VS_MARKETPLACE_TOKEN }} --share-with ${{ secrets.SHARE_VSTS_ACCOUNTS }} + + # - name: Create GitHub Release + # if: success() + # uses: actions/create-release@v1 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # tag_name: v${{ steps.get_extension_version.outputs.version }} + # release_name: Release v${{ steps.get_extension_version.outputs.version }} + # body: | + # ## New Release: v${{ steps.get_extension_version.outputs.version }} + # + # This release includes the latest updates for the Azure DevOps extension. + # draft: false + # prerelease: false diff --git a/ai-code-review/package.json b/ai-code-review/package.json index 791411b..e6c5f47 100644 --- a/ai-code-review/package.json +++ b/ai-code-review/package.json @@ -1,6 +1,6 @@ { "name": "azure-devops-ai-code-review", - "version": "1.0.17", + "version": "1.0.20", "description": "", "main": "index.js", "scripts": { diff --git a/ai-code-review/task.json b/ai-code-review/task.json index 35242cf..6ab0fbc 100644 --- a/ai-code-review/task.json +++ b/ai-code-review/task.json @@ -8,7 +8,7 @@ "version": { "Major": 1, "Minor": 0, - "Patch": 17 + "Patch": 20 }, "instanceNameFormat": "AI Code Review $(message)", "inputs": [ @@ -90,7 +90,6 @@ "defaultValue": false, "helpMarkDown": "Specify whether to enable checking with Architecture Decision Records (ADRs) during the code review process.\n\n- Set to `true` to perform checks with ADRs.\n- Set to `false` to skip checks with ADRs.\n\nChecking with ADRs helps ensure that the code aligns with architectural decisions. Default value is `false`." }, - { "name": "reviewBugs", "type": "boolean", diff --git a/package.json b/package.json index 1af3c6c..378c0e0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "azure-devops-ai-code-review", - "version": "1.0.17", + "version": "1.0.20", "description": "AI code review extension for Azure DevOps using Azure OpenAI services", "main": "main.js", "scripts": { diff --git a/scripts/rev_version.sh b/scripts/rev_version.sh new file mode 100755 index 0000000..1a3bd77 --- /dev/null +++ b/scripts/rev_version.sh @@ -0,0 +1,115 @@ +#!/bin/bash + +# Update version across all package.json, vss-extension.json, and task.json files +# Usage: ./rev_version.sh [n.n.n] +# If version is not provided, it will read from root package.json and bump the patch version + +set -e + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" + +# Files to update +ROOT_PACKAGE_JSON="$REPO_ROOT/package.json" +AI_PACKAGE_JSON="$REPO_ROOT/ai-code-review/package.json" +VSS_EXTENSION_JSON="$REPO_ROOT/vss-extension.json" +TASK_JSON="$REPO_ROOT/ai-code-review/task.json" + +if ! command -v jq &> /dev/null; then + echo "Error: jq is not installed. Please install jq to use this script." + echo " Ubuntu/Debian: sudo apt-get install jq" + echo " macOS: brew install jq" + exit 1 +fi + +validate_version() { + local version=$1 + if ! [[ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "Error: Invalid version format '$version'. Expected format: n.n.n (e.g., 1.0.17)" + exit 1 + fi +} + +get_current_version() { + if [ ! -f "$ROOT_PACKAGE_JSON" ]; then + echo "Error: Root package.json not found at $ROOT_PACKAGE_JSON" + exit 1 + fi + + jq -r '.version' "$ROOT_PACKAGE_JSON" +} + +bump_patch_version() { + local version=$1 + local major=$(echo "$version" | cut -d. -f1) + local minor=$(echo "$version" | cut -d. -f2) + local patch=$(echo "$version" | cut -d. -f3) + + patch=$((patch + 1)) + echo "$major.$minor.$patch" +} + +update_json_version() { + local file=$1 + local new_version=$2 + + if [ ! -f "$file" ]; then + echo "Warning: File not found: $file" + return + fi + + jq --arg version "$new_version" '.version = $version' "$file" > "${file}.tmp" + mv "${file}.tmp" "$file" + + echo "Updated $file to version $new_version" +} + +update_task_json_version() { + local file=$1 + local new_version=$2 + + if [ ! -f "$file" ]; then + echo "Warning: File not found: $file" + return + fi + + local major=$(echo "$new_version" | cut -d. -f1) + local minor=$(echo "$new_version" | cut -d. -f2) + local patch=$(echo "$new_version" | cut -d. -f3) + + jq --argjson major "$major" --argjson minor "$minor" --argjson patch "$patch" \ + '.version.Major = $major | .version.Minor = $minor | .version.Patch = $patch' \ + "$file" > "${file}.tmp" + mv "${file}.tmp" "$file" + + echo "Updated $file to version $new_version (Major: $major, Minor: $minor, Patch: $patch)" +} + +main() { + local new_version + + if [ -n "$1" ]; then + new_version=$1 + validate_version "$new_version" + echo "Using provided version: $new_version" + else + local current_version=$(get_current_version) + new_version=$(bump_patch_version "$current_version") + echo "Current version: $current_version" + echo "Bumping to version: $new_version" + fi + + echo "" + echo "Updating version to $new_version in all files..." + echo "" + + update_json_version "$ROOT_PACKAGE_JSON" "$new_version" + update_json_version "$AI_PACKAGE_JSON" "$new_version" + update_json_version "$VSS_EXTENSION_JSON" "$new_version" + update_task_json_version "$TASK_JSON" "$new_version" + + echo "" + echo "Version update complete! All files updated to version $new_version" +} + +main "$@" diff --git a/vss-extension.json b/vss-extension.json index 3ddac07..7743e69 100644 --- a/vss-extension.json +++ b/vss-extension.json @@ -1,46 +1,61 @@ -{ - "manifestVersion": 1, - "id": "ai-code-review", - "publisher": "Your-publisher-id", - "version": "1.0.17", - "name": "AI Code Review Task", - "description": "AI code review extension to review pull request changes using your own Azure OpenAI endpoints", - "public": false, - "categories": ["Azure Repos", "Azure Pipelines"], - "tags": ["ai", "openai", "gpt", "llm", "gpt4", "copilot", "code", "review", "chatgpt"], - "icons": { - "default": "images/icon-128x128.png" - }, - "targets": [ - { - "id": "Microsoft.VisualStudio.Services" - } - ], - "contributions": [ - { - "id": "AICodeReview", - "type": "ms.vss-distributed-task.task", - "targets": ["ms.vss-distributed-task.tasks"], - "properties": { - "name": "ai-code-review" - } - } - ], - "content": { - "details": { - "path": "README.md" - }, - "license": { - "path": "LICENSE.txt" - } - }, - "files": [ - { - "path": "ai-code-review" - }, - { - "path": "images", - "addressable": true - } - ] -} +{ + "manifestVersion": 1, + "id": "swdevflow-code-review", + "publisher": "SWDevflow", + "version": "1.0.20", + "name": "AI Code Review Task", + "description": "AI code review extension to review pull request changes using your own Azure OpenAI endpoints", + "public": false, + "categories": [ + "Azure Repos", + "Azure Pipelines" + ], + "tags": [ + "ai", + "openai", + "gpt", + "llm", + "gpt4", + "copilot", + "code", + "review", + "chatgpt" + ], + "icons": { + "default": "images/icon-128x128.png" + }, + "targets": [ + { + "id": "Microsoft.VisualStudio.Services" + } + ], + "contributions": [ + { + "id": "AICodeReview", + "type": "ms.vss-distributed-task.task", + "targets": [ + "ms.vss-distributed-task.tasks" + ], + "properties": { + "name": "ai-code-review" + } + } + ], + "content": { + "details": { + "path": "README.md" + }, + "license": { + "path": "LICENSE.txt" + } + }, + "files": [ + { + "path": "ai-code-review" + }, + { + "path": "images", + "addressable": true + } + ] +} From 46c3c94724121d29f2344f860d1f288b70849e99 Mon Sep 17 00:00:00 2001 From: FacuBar Date: Thu, 27 Nov 2025 17:32:52 -0300 Subject: [PATCH 2/6] bump version - testing --- ai-code-review/package.json | 2 +- ai-code-review/task.json | 2 +- package.json | 2 +- vss-extension.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ai-code-review/package.json b/ai-code-review/package.json index e6c5f47..bdf1aaa 100644 --- a/ai-code-review/package.json +++ b/ai-code-review/package.json @@ -1,6 +1,6 @@ { "name": "azure-devops-ai-code-review", - "version": "1.0.20", + "version": "1.0.21", "description": "", "main": "index.js", "scripts": { diff --git a/ai-code-review/task.json b/ai-code-review/task.json index 6ab0fbc..87a1905 100644 --- a/ai-code-review/task.json +++ b/ai-code-review/task.json @@ -8,7 +8,7 @@ "version": { "Major": 1, "Minor": 0, - "Patch": 20 + "Patch": 21 }, "instanceNameFormat": "AI Code Review $(message)", "inputs": [ diff --git a/package.json b/package.json index 378c0e0..08b7585 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "azure-devops-ai-code-review", - "version": "1.0.20", + "version": "1.0.21", "description": "AI code review extension for Azure DevOps using Azure OpenAI services", "main": "main.js", "scripts": { diff --git a/vss-extension.json b/vss-extension.json index 7743e69..8b194d8 100644 --- a/vss-extension.json +++ b/vss-extension.json @@ -2,7 +2,7 @@ "manifestVersion": 1, "id": "swdevflow-code-review", "publisher": "SWDevflow", - "version": "1.0.20", + "version": "1.0.21", "name": "AI Code Review Task", "description": "AI code review extension to review pull request changes using your own Azure OpenAI endpoints", "public": false, From 66c4bec3c00669ec9c41db6fba88d041091d850d Mon Sep 17 00:00:00 2001 From: FacuBar Date: Thu, 27 Nov 2025 17:56:52 -0300 Subject: [PATCH 3/6] update lock files as well --- ai-code-review/package-lock.json | 4 ++-- package-lock.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ai-code-review/package-lock.json b/ai-code-review/package-lock.json index 73628d5..2260c30 100644 --- a/ai-code-review/package-lock.json +++ b/ai-code-review/package-lock.json @@ -1,12 +1,12 @@ { "name": "azure-devops-ai-code-review", - "version": "1.0.17", + "version": "1.0.21", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "azure-devops-ai-code-review", - "version": "1.0.17", + "version": "1.0.21", "license": "MIT", "dependencies": { "@azure/openai": "2.0.0-beta.2", diff --git a/package-lock.json b/package-lock.json index bfa8ff1..7f8117b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "azure-devops-ai-code-review", - "version": "1.0.17", + "version": "1.0.21", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "azure-devops-ai-code-review", - "version": "1.0.17", + "version": "1.0.21", "dependencies": { "vss-web-extension-sdk": "^5.141.0" } From 9eb01cdffcc57551f4490682fb7ba0445e7b0ceb Mon Sep 17 00:00:00 2001 From: FacuBar Date: Thu, 27 Nov 2025 18:01:32 -0300 Subject: [PATCH 4/6] add temporal trigger for testing --- .github/workflows/publish.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 2bb2a7b..1d9d7ec 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -3,6 +3,10 @@ name: Publish Azure DevOps Extension to Marketplace on: # INFO: Ideally this should also trigger from push to tagged version branch workflow_dispatch: + # TODO: Temporal trigger + push: + branches: + - '123817-prompt_injection_protection' jobs: publish: From 53aca497547a2c32abbe670242d04b93ea7d7423 Mon Sep 17 00:00:00 2001 From: FacuBar Date: Thu, 27 Nov 2025 18:12:51 -0300 Subject: [PATCH 5/6] trigger pipeline --- .github/workflows/publish.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 1d9d7ec..7f6f060 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -7,6 +7,7 @@ on: push: branches: - '123817-prompt_injection_protection' + - '123985-cicd_publish' jobs: publish: From a4ab0fedabc3f4d5a08453f3d897d4949a314ad2 Mon Sep 17 00:00:00 2001 From: FacuBar Date: Thu, 27 Nov 2025 18:20:33 -0300 Subject: [PATCH 6/6] remove temporal triggers and remove non-wanted validations to reduce pipeline run time --- .github/workflows/publish.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 7f6f060..8b92cb6 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -3,11 +3,6 @@ name: Publish Azure DevOps Extension to Marketplace on: # INFO: Ideally this should also trigger from push to tagged version branch workflow_dispatch: - # TODO: Temporal trigger - push: - branches: - - '123817-prompt_injection_protection' - - '123985-cicd_publish' jobs: publish: @@ -46,7 +41,7 @@ jobs: run: tfx extension create - name: Publish extension to Azure DevOps Marketplace - run: tfx extension publish -t ${{ secrets.VS_MARKETPLACE_TOKEN }} --share-with ${{ secrets.SHARE_VSTS_ACCOUNTS }} + run: tfx extension publish -t ${{ secrets.VS_MARKETPLACE_TOKEN }} --share-with ${{ secrets.SHARE_VSTS_ACCOUNTS }} --no-wait-validation # - name: Create GitHub Release # if: success()