Skip to content

Commit eaef525

Browse files
committed
Add: CI/CD pipeline
1 parent bbaca6a commit eaef525

4 files changed

Lines changed: 108 additions & 2 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: ["**"]
6+
pull_request:
7+
8+
concurrency:
9+
group: ci-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
ci:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- uses: actions/setup-node@v4
19+
with:
20+
node-version: 22
21+
cache: npm
22+
23+
- run: npm ci
24+
- run: npm run lint --if-present
25+
- run: npm test --if-present
26+
- run: npm run compile

‎.github/workflows/release.yml‎

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
bump:
7+
description: "Version bump type"
8+
required: true
9+
type: choice
10+
options: [patch, minor, major]
11+
12+
concurrency:
13+
group: release
14+
cancel-in-progress: false
15+
16+
permissions:
17+
contents: write
18+
19+
jobs:
20+
release:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout main (full history for tags)
24+
uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
ref: main
28+
29+
- uses: actions/setup-node@v4
30+
with:
31+
node-version: 22
32+
cache: npm
33+
34+
- run: npm ci
35+
- run: npm run lint --if-present
36+
- run: npm run typecheck --if-present
37+
- run: npm test --if-present
38+
- run: npm run compile
39+
40+
- name: Configure git identity
41+
run: |
42+
git config user.name "github-actions[bot]"
43+
git config user.email "github-actions[bot]@users.noreply.github.com"
44+
45+
- name: Ensure working tree is clean
46+
run: |
47+
if [ -n "$(git status --porcelain)" ]; then
48+
echo "Working tree is not clean."
49+
git status --porcelain
50+
exit 1
51+
fi
52+
53+
- name: Bump version + create tag
54+
id: bump
55+
run: |
56+
NEW_TAG="$(npm version ${{ inputs.bump }} -m "chore(release): v%s")"
57+
echo "new_tag=$NEW_TAG" >> "$GITHUB_OUTPUT"
58+
echo "Created tag: $NEW_TAG"
59+
60+
- name: Push commit + tag
61+
run: git push --follow-tags origin main
62+
63+
- name: Package (vsix)
64+
run: npx vsce package --no-dependencies
65+
66+
- name: Publish to VS Code Marketplace
67+
env:
68+
VSCE_PAT: ${{ secrets.VSCE_PAT }}
69+
run: npx vsce publish -p "$VSCE_PAT"
70+
71+
- name: Create GitHub Release + upload VSIX
72+
uses: softprops/action-gh-release@v2
73+
with:
74+
tag_name: ${{ steps.bump.outputs.new_tag }}
75+
generate_release_notes: true
76+
files: "*.vsix"

‎.vscode/extensions.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// for the documentation about the extensions.json format
44
"recommendations": [
55
"dbaeumer.vscode-eslint",
6-
"ms-vscode.extension-test-runner"
6+
"ms-vscode.extension-test-runner",
7+
"ozgen.git-worklists"
78
]
89
}

‎package.json‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,10 @@
238238
"watch": "tsc -watch -p ./",
239239
"pretest": "npm run compile && npm run lint",
240240
"lint": "eslint src",
241-
"test": "vscode-test"
241+
"test": "vscode-test",
242+
"release:patch": "npm version patch -m \"chore(release): v%s\"",
243+
"release:minor": "npm version minor -m \"chore(release): v%s\"",
244+
"release:major": "npm version major -m \"chore(release): v%s\""
242245
},
243246
"devDependencies": {
244247
"@types/vscode": "^1.109.0",

0 commit comments

Comments
 (0)