Skip to content

chore(Icon): 品牌图标改用透明底绿色圆环(Emerald)方案并新增 galleryBanner; #124

chore(Icon): 品牌图标改用透明底绿色圆环(Emerald)方案并新增 galleryBanner;

chore(Icon): 品牌图标改用透明底绿色圆环(Emerald)方案并新增 galleryBanner; #124

Workflow file for this run

name: CI
on:
push:
branches: [master, feature/1.x.x]
tags:
- 'v*'
pull_request:
permissions:
contents: read
jobs:
# 闸门:类型检查 + lint + 生产构建(快门,ubuntu 单格)
lint-build:
name: Lint & Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: pnpm/action-setup@v6
- uses: actions/setup-node@v6
with:
node-version: 22
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- run: pnpm run check-types
- run: pnpm run lint
- run: pnpm run package
# 集成测试矩阵:main/tag 跑三平台,PR 仅 ubuntu 快门
test:
name: Test (${{ matrix.os }})
needs: lint-build
strategy:
fail-fast: false
matrix:
os: ${{ (github.event_name == 'pull_request') && fromJson('["ubuntu-latest"]') || fromJson('["ubuntu-latest", "macos-latest", "windows-latest"]') }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- uses: pnpm/action-setup@v6
- uses: actions/setup-node@v6
with:
node-version: 22
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- name: 构建 dist/extension.js(集成测试需加载扩展)
run: node esbuild.js
- run: pnpm run test:unit
- name: 集成测试(Linux 需 xvfb 包装 Electron)
run: xvfb-run -a pnpm run test:integration
if: runner.os == 'Linux'
- name: 集成测试
run: pnpm run test:integration
if: runner.os != 'Linux'
# 打包 vsix(Linux 保 POSIX 文件属性)
package:
name: Package vsix
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: pnpm/action-setup@v6
- uses: actions/setup-node@v6
with:
node-version: 22
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- run: pnpm dlx @vscode/vsce package --no-yarn
- uses: actions/upload-artifact@v7
with:
name: vsix
path: '*.vsix'
if-no-files-found: error
# GitHub Release:仅 tag 触发,将 .vsix 作为可本地安装资产附带(与市场 publish 解耦)
github-release:
name: GitHub Release (.vsix)
needs: package
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
# 检出仓库:使 body_path 指向的 Release Note 文件可见
- uses: actions/checkout@v4
- uses: actions/download-artifact@v8
with:
name: vsix
- name: 创建/更新 GitHub Release 并附带 .vsix
uses: softprops/action-gh-release@v3
with:
files: '*.vsix'
prerelease: ${{ contains(github.ref_name, 'rc') }}
# Release 正文取自版本控制的 Release Note(单一事实源,按 tag 名取对应文件)
body_path: docs/releases/${{ github.ref_name }}.md
fail_on_unmatched_files: true
# 发布:仅 tag 触发;OpenVSX 默认发布,VS Code Marketplace 由 ENABLE_MARKETPLACE_PUBLISH 变量门控(默认关闭);生产环境审批门
publish:
name: Publish
needs: package
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
environment: production
steps:
- uses: actions/checkout@v7
- uses: pnpm/action-setup@v6
- uses: actions/setup-node@v6
with:
node-version: 22
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- uses: actions/download-artifact@v8
with:
name: vsix
# VS Code Marketplace 发布:默认关闭(未配置 VSCE_PAT)。
# 配好 VSCE_PAT 后,在仓库 Settings → Secrets and variables → Actions → Variables
# 新增 ENABLE_MARKETPLACE_PUBLISH=true 即恢复,无需改代码或发 PR。
- name: 发布到 VS Code Marketplace
if: ${{ vars.ENABLE_MARKETPLACE_PUBLISH == 'true' }}
run: |
PRE_FLAG=$([[ "${GITHUB_REF_NAME}" == *rc* ]] && echo "--pre-release" || echo "")
pnpm dlx @vscode/vsce publish --packagePath *.vsix $PRE_FLAG
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
# OpenVSX 不支持覆盖已存在版本:若该版本号已发布则此步报错。
# 以 continue-on-error 隔离——不阻断 GitHub Release 产出,亦不让首发 workflow 标红。
- name: 发布到 OpenVSX(覆盖 Cursor / Windsurf 等 AI IDE)
continue-on-error: true
run: |
PRE_FLAG=$([[ "${GITHUB_REF_NAME}" == *rc* ]] && echo "--pre-release" || echo "")
pnpm dlx ovsx publish *.vsix $PRE_FLAG
env:
OVSX_PAT: ${{ secrets.OVSX_PAT }}