Skip to content

chore(deps-dev): bump eslint from 10.6.0 to 10.7.0 (#90) #222

chore(deps-dev): bump eslint from 10.6.0 to 10.7.0 (#90)

chore(deps-dev): bump eslint from 10.6.0 to 10.7.0 (#90) #222

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
# rc tag 以 --pre-release 打包:VS Code 要求「预发布 VSIX」在打包时即标记,
# 否则 publish job 的 `vsce publish --pre-release` 会报「未以 pre-release 打包」而失败。
# 与 publish 步骤同款 PRE_FLAG 判定,保证同一枚 VSIX 贯穿 GitHub Release 与 Marketplace。
- name: 打包 vsix(rc tag 自动带 --pre-release)
run: |
PRE_FLAG=$([[ "${GITHUB_REF_NAME}" == *rc* ]] && echo "--pre-release" || echo "")
pnpm dlx @vscode/vsce package --no-yarn $PRE_FLAG
- 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@v7
- 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 触发;发布到 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 发布:由仓库变量 ENABLE_MARKETPLACE_PUBLISH 门控(=true 时发布)。
# 需配置 VSCE_PAT(Azure DevOps PAT,scope: Marketplace → Manage);rc tag 自动以 --pre-release 发预发布通道。
- 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 }}