Publish to Visual Studio Marketplace #9
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish to Visual Studio Marketplace | |
| # 触发器:仅当一个 v*.*.* 格式的标签被推送到仓库时才运行 | |
| on: | |
| push: | |
| tags: | |
| - 'v*.*.*' | |
| # 添加权限配置 | |
| permissions: | |
| contents: write # 允许创建 release 和上传文件 | |
| jobs: | |
| publish_to_marketplace: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Add aarch64 target | |
| run: rustup target add aarch64-unknown-linux-gnu | |
| - name: Install aarch64 gcc | |
| run: sudo apt-get update && sudo apt-get install -y gcc-aarch64-linux-gnu | |
| - name: Build Native Rust Backend (x64) | |
| run: | | |
| cd rust-core | |
| npm ci || true | |
| npx napi build --platform --target x86_64-unknown-linux-gnu --output-dir ../native-bindings | |
| - name: Build Native Rust Backend (arm64) | |
| run: | | |
| cd rust-core | |
| CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc npx napi build --platform --target aarch64-unknown-linux-gnu --output-dir ../native-bindings | |
| - name: Install vsce | |
| run: npm install -g @vscode/vsce | |
| - name: Package VSIX | |
| run: vsce package --no-yarn | |
| - name: Create GitHub Release | |
| id: create_release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| # files 字段指定了要上传哪些文件,支持通配符 | |
| files: "*.vsix" | |
| # GITHUB_TOKEN 是由 GitHub Actions 自动生成的,有权限创建 Release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # 发布到 Visual Studio Marketplace | |
| - name: Publish to Visual Studio Marketplace | |
| run: vsce publish --no-yarn | |
| env: | |
| # VSCE_PAT 是你需要自己设置的 Personal Access Token | |
| VSCE_PAT: ${{ secrets.VSCE_PAT }} | |
| # 发布到 Open VSX Registry | |
| - name: Install ovsx | |
| run: npm install -g ovsx | |
| - name: Publish to Open VSX Registry | |
| run: ovsx publish *.vsix -p ${{ secrets.OVSX_PAT }} |