diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..8b92cb6 --- /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 }} --no-wait-validation + + # - 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-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/ai-code-review/package.json b/ai-code-review/package.json index 791411b..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.17", + "version": "1.0.21", "description": "", "main": "index.js", "scripts": { diff --git a/ai-code-review/task.json b/ai-code-review/task.json index 35242cf..87a1905 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": 21 }, "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-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" } diff --git a/package.json b/package.json index 1af3c6c..08b7585 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "azure-devops-ai-code-review", - "version": "1.0.17", + "version": "1.0.21", "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..8b194d8 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.21", + "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 + } + ] +}