Files
yvgude--lean-ctx/.github/workflows/publish-vscode.yml
T
wehub-resource-sync 26382a7ac6
CI / Clippy (push) Failing after 15m13s
CI / Test (ubuntu-latest) (push) Failing after 16m1s
CI / Test (macos-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Build (no embeddings / no ORT) (push) Has been cancelled
CI / Format (push) Has been cancelled
CI / Cookbook (Node) (push) Has been cancelled
CI / Pi Extension (Node) (push) Has been cancelled
CI / Rust SDK (lean-ctx-client) (push) Has been cancelled
CI / Embed SDK (lean-ctx-sdk) (push) Has been cancelled
CI / Python SDK (leanctx) (push) Has been cancelled
CI / Hermes Plugin (Python) (push) Has been cancelled
CI / SDK Conformance Matrix (push) Has been cancelled
CI / Coverage (push) Has been cancelled
CI / cargo-deny (push) Has been cancelled
CI / Adversarial Safety (push) Has been cancelled
CI / Benchmarks (push) Has been cancelled
CI / Output-Quality Gate (eval A/B) (push) Has been cancelled
CI / Documentation (push) Has been cancelled
CI / CI Green (push) Has been cancelled
JetBrains Plugin / Actionlint (push) Has been cancelled
CodeQL / Analyze (actions) (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
CodeQL / Analyze (rust) (push) Has been cancelled
JetBrains Plugin / Validation (push) Has been cancelled
JetBrains Plugin / Build (push) Has been cancelled
JetBrains Plugin / Test (push) Has been cancelled
Security Check / Security Scan (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:35:30 +08:00

94 lines
3.6 KiB
YAML

name: Publish VS Code Extension
# Decoupled from the binary `Release` workflow so the editor extension ships on
# its own cadence. Trigger either by pushing a `vscode-v*` tag (e.g. vscode-v0.1.0)
# or manually via the Actions tab with an explicit version.
on:
push:
tags:
- 'vscode-v*'
workflow_dispatch:
inputs:
version:
description: 'Extension version to publish (e.g. 0.1.0). Defaults to package.json.'
required: false
type: string
permissions:
contents: write
jobs:
publish-vscode:
name: Package & publish (Marketplace + Open VSX)
runs-on: ubuntu-latest
defaults:
run:
working-directory: vscode-extension
env:
# Step-level `if` guards read these so the job still packages + uploads the
# .vsix even before the publishing tokens are configured as repo secrets.
VSCE_PAT: ${{ secrets.VSCE_PAT }}
OVSX_PAT: ${{ secrets.OVSX_PAT }}
steps:
- uses: actions/checkout@v4 # v4
with:
persist-credentials: false
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 22
- name: Install dependencies
run: npm install
- name: Resolve version
id: ver
run: |
if [ -n "${{ inputs.version }}" ]; then
VERSION="${{ inputs.version }}"
elif [[ "${GITHUB_REF_NAME}" == vscode-v* ]]; then
VERSION="${GITHUB_REF_NAME#vscode-v}"
else
VERSION="$(node -p "require('./package.json').version")"
fi
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
npm version "${VERSION}" --no-git-tag-version --allow-same-version
- name: Compile
run: npm run compile
- name: Package .vsix
run: npx @vscode/vsce package --no-dependencies -o "${GITHUB_WORKSPACE}/lean-ctx-${{ steps.ver.outputs.version }}.vsix"
- name: Publish to VS Code Marketplace
if: ${{ env.VSCE_PAT != '' }}
run: npx @vscode/vsce publish --packagePath "${GITHUB_WORKSPACE}/lean-ctx-${{ steps.ver.outputs.version }}.vsix" -p "${VSCE_PAT}"
- name: Publish to Open VSX (Cursor / VSCodium / Windsurf)
if: ${{ env.OVSX_PAT != '' }}
run: npx ovsx publish "${GITHUB_WORKSPACE}/lean-ctx-${{ steps.ver.outputs.version }}.vsix" -p "${OVSX_PAT}"
- name: Upload .vsix artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: lean-ctx-vsix
path: lean-ctx-*.vsix
- name: Attach .vsix to GitHub release
if: ${{ startsWith(github.ref, 'refs/tags/vscode-v') }}
uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65 # v2
with:
tag_name: ${{ github.ref_name }}
# Never let the extension release become the repo's "latest" — install.sh
# and the npm postinstall resolve binaries via /releases/latest, so a
# vscode-v* release hijacking "latest" breaks CLI installs (see #345).
make_latest: false
name: lean-ctx VS Code extension ${{ steps.ver.outputs.version }}
files: lean-ctx-*.vsix
body: |
lean-ctx VS Code extension **${{ steps.ver.outputs.version }}**.
Install from the [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=LeanCTX.lean-ctx)
or [Open VSX](https://open-vsx.org/extension/LeanCTX/lean-ctx) (Cursor, VSCodium, Windsurf),
or download the `.vsix` below and run `code --install-extension lean-ctx-${{ steps.ver.outputs.version }}.vsix`.