Code MCP Server

Official
name: Publish VSCode extension on: push: paths: - 'extension/**' - '.github/workflows/extension-vsce-publish.yml' workflow_dispatch: defaults: run: working-directory: ./extension jobs: build: runs-on: ubuntu-latest steps: - name: Check out repository uses: actions/checkout@v4 - name: Set up Node.js uses: actions/setup-node@v4 with: node-version: 20 # cache: "npm" # cache-dependency-path: "./extension/package-lock.json" - name: Install dependencies run: npm ci # - name: Run tests # run: npm test # - name: Package Extension # run: npm run package-extension - name: Install vsce run: npm install -g @vscode/vsce - name: Check if version exists id: version_check run: | VERSION=$(node -p "require('./package.json').version") echo "Current package.json version: $VERSION" echo "============ BEGIN VSCE SHOW OUTPUT ============" # Capture the full output to both display and use for version checking VSCE_OUTPUT=$(vsce show block.vscode-mcp-extension || echo "Command failed") echo "$VSCE_OUTPUT" echo "============= END VSCE SHOW OUTPUT =============" VERSION_EXISTS=false # Check for version in different output formats # Plain text "Version: X.X.X" format if echo "$VSCE_OUTPUT" | grep -q "Version:[[:space:]]*$VERSION"; then echo "NOTICE: Version $VERSION already exists in marketplace (found in Version field)" VERSION_EXISTS=true fi # Version table format if echo "$VSCE_OUTPUT" | grep -q "^[[:space:]]*$VERSION[[:space:]]"; then echo "NOTICE: Version $VERSION already exists in marketplace (found in version table)" VERSION_EXISTS=true fi # Check for any occurrence of the version if echo "$VSCE_OUTPUT" | grep -w "$VERSION" | grep -v "Current package.json version"; then echo "NOTICE: Version $VERSION may exist in the marketplace" echo "Please verify the output above carefully" VERSION_EXISTS=true fi if [ "$VERSION_EXISTS" = "true" ]; then echo "Skipping publish step as version already exists" echo "version_exists=true" >> $GITHUB_OUTPUT else echo "Version $VERSION is new and can be published" echo "version_exists=false" >> $GITHUB_OUTPUT fi - name: Publish to Visual Studio Marketplace if: steps.version_check.outputs.version_exists != 'true' run: npm run publish-extension env: VSCE_PAT: ${{ secrets.VSCE_PAT }} # - name: Create GitHub Release # uses: softprops/action-gh-release@v1 # if: success() # with: # files: "*.vsix" # generate_release_notes: true # env: # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}