Skip to content

Commit 3fbbe62

Browse files
committed
Merge branch 'dev' of github.com:kalifun/vscode-proto3-tools into dev
2 parents 86cc141 + 382bfc0 commit 3fbbe62

5 files changed

Lines changed: 1917 additions & 14 deletions

File tree

.github/workflows/ci.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
branches: [main, master]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- uses: actions/setup-node@v4
16+
with:
17+
node-version: "20"
18+
cache: yarn
19+
20+
- name: Install
21+
run: yarn install --frozen-lockfile
22+
23+
- name: Compile
24+
run: yarn compile
25+
26+
- name: Lint
27+
run: yarn lint

.github/workflows/release.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# 推送形如 v0.2.0 的 tag 时:校验版本、打 VSIX、创建 GitHub Release、发布到 VS Code 市场。
2+
# 仓库 Settings → Secrets → Actions 中配置 VSCE_PAT(Azure DevOps PAT,勾选 Marketplace > Manage)。
3+
# 发版前请先把 package.json 的 version 改成与 tag 一致(tag 去掉前缀 v)。
4+
5+
name: Release
6+
7+
on:
8+
push:
9+
tags:
10+
- "v*"
11+
12+
permissions:
13+
contents: write
14+
15+
jobs:
16+
publish:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- uses: actions/setup-node@v4
22+
with:
23+
node-version: "20"
24+
cache: yarn
25+
26+
- name: Install
27+
run: yarn install --frozen-lockfile
28+
29+
- name: Compile
30+
run: yarn compile
31+
32+
- name: Lint
33+
run: yarn lint
34+
35+
- name: Match package.json version to tag
36+
run: |
37+
TAG="${GITHUB_REF#refs/tags/v}"
38+
VER=$(node -p "require('./package.json').version")
39+
if [ "$VER" != "$TAG" ]; then
40+
echo "::error::package.json version ($VER) must equal git tag without v prefix ($TAG)"
41+
exit 1
42+
fi
43+
44+
- name: Package VSIX
45+
run: yarn vsix
46+
47+
- name: Create GitHub Release
48+
uses: softprops/action-gh-release@v2
49+
with:
50+
files: "*.vsix"
51+
generate_release_notes: true
52+
env:
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54+
55+
- name: Publish to VS Code Marketplace
56+
env:
57+
VSCE_PAT: ${{ secrets.VSCE_PAT }}
58+
run: |
59+
if [ -z "$VSCE_PAT" ]; then
60+
echo "::error::Missing secret VSCE_PAT. Create a PAT at https://dev.azure.com (Marketplace > Manage) and add it under Repo Settings → Secrets → Actions."
61+
exit 1
62+
fi
63+
VSIX=$(ls -1 ./*.vsix | head -1)
64+
npx vsce publish --pat "$VSCE_PAT" --packagePath "$VSIX"

.vscodeignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@ vsc-extension-quickstart.md
88
**/.eslintrc.json
99
**/*.map
1010
**/*.ts
11+
.github/**
12+
.direnv/**
13+
.envrc

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,9 @@
153153
"watch": "tsc -watch -p ./",
154154
"pretest": "yarn run compile && yarn run lint",
155155
"lint": "eslint src --ext ts",
156-
"test": "node ./out/test/runTest.js"
156+
"test": "node ./out/test/runTest.js",
157+
"ci": "yarn compile && yarn lint",
158+
"vsix": "vsce package"
157159
},
158160
"devDependencies": {
159161
"@types/glob": "^7.2.0",
@@ -164,6 +166,7 @@
164166
"@typescript-eslint/eslint-plugin": "^5.31.0",
165167
"@typescript-eslint/parser": "^5.31.0",
166168
"@vscode/test-electron": "^2.1.5",
169+
"@vscode/vsce": "^3.2.1",
167170
"eslint": "^8.20.0",
168171
"glob": "^8.0.3",
169172
"mocha": "^10.0.0",

0 commit comments

Comments
 (0)