添加工作流文件

This commit is contained in:
2025-11-18 14:04:48 +08:00
parent 515ab4ff91
commit ef67c1bb2c
3 changed files with 457 additions and 198 deletions

View File

@@ -0,0 +1,59 @@
name: CI/CD Pipeline for DevStar Extension
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
container:
image: gitea/runner-images:ubuntu-latest
steps:
- name: 拉取代码
uses: https://devstar.cn/actions/checkout@v4
with:
fetch-depth: 0
- name: 安装依赖
run: |
npm install
- name: 构建插件
run: |
webpack --mode production && vsce package
- name: 上传构建产物
uses: https://devstar.cn/actions/upload-artifact@v4
with:
name: devstar-extension
path: "*.vsix"
publish:
needs: build
runs-on: ubuntu-latest
if: gitea.ref == 'refs/heads/main'
steps:
- name: 拉取代码
uses: https://devstar.cn/actions/checkout@v4
- name: 安装依赖
run: |
npm install
- name: 发布到 VSCode 市场
run: vsce publish
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
- name: 更新版本标签
run: |
version=$(node -p "require('./package.json').version")
git config --local user.email "ci@devstar.cn"
git config --local user.name "DevStar CI"
git tag -a "v$version" -m "Release version $version"
git push origin "v$version"