Skip to content

Commit a848d4b

Browse files
authored
Merge pull request #11 from zenml-io/misc/add-ci-to-auto-build-extensions
Add GitHub Actions workflow for building VSCode extensions
2 parents 48d9967 + f6cf50f commit a848d4b

File tree

1 file changed

+94
-0
lines changed

1 file changed

+94
-0
lines changed
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Build VSCode Extensions
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main, develop]
8+
workflow_dispatch:
9+
inputs:
10+
force_rebuild:
11+
description: 'Force rebuild even if no changes detected'
12+
required: false
13+
default: false
14+
type: boolean
15+
16+
jobs:
17+
build-extensions:
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
24+
- name: Set up Node.js
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: '22'
28+
cache: 'npm'
29+
30+
- name: Install dependencies
31+
run: npm ci
32+
33+
- name: Install vsce globally
34+
run: npm install -g @vscode/vsce
35+
36+
- name: Build tutorial extension
37+
run: |
38+
echo "Building tutorial extension..."
39+
npm run buildExtension
40+
41+
- name: Build theme extension
42+
run: |
43+
echo "Building theme extension..."
44+
cd themes && npx @vscode/vsce package --out ../zenml-color-theme.vsix
45+
46+
- name: Verify extensions were built
47+
run: |
48+
echo "Checking built extensions..."
49+
if [ -d ".devcontainer/extensions" ]; then
50+
echo "Tutorial extension files:"
51+
ls -la .devcontainer/extensions/
52+
else
53+
echo "ERROR: .devcontainer/extensions directory not found"
54+
exit 1
55+
fi
56+
57+
if [ -f "zenml-color-theme.vsix" ]; then
58+
echo "Theme extension built successfully:"
59+
ls -la zenml-color-theme.vsix
60+
else
61+
echo "ERROR: zenml-color-theme.vsix not found"
62+
exit 1
63+
fi
64+
65+
- name: Upload tutorial extension artifact
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: tutorial-extension
69+
path: .devcontainer/extensions/zenml-codespace-tutorial-*.vsix
70+
71+
- name: Upload theme extension artifact
72+
uses: actions/upload-artifact@v4
73+
with:
74+
name: theme-extension
75+
path: zenml-color-theme.vsix
76+
77+
- name: Commit and push built extensions
78+
# Only commit on push to main/develop branches, not on PRs
79+
if: github.event_name == 'push' || github.event.inputs.force_rebuild
80+
run: |
81+
git config --local user.email "[email protected]"
82+
git config --local user.name "GitHub Action"
83+
84+
# Add the built extensions to git
85+
git add .devcontainer/extensions/zenml-codespace-tutorial-*.vsix
86+
git add zenml-color-theme.vsix
87+
88+
# Check if there are any changes to commit
89+
if git diff --staged --quiet; then
90+
echo "No changes to commit"
91+
else
92+
git commit -m "Auto-build extensions [skip ci]"
93+
git push
94+
fi

0 commit comments

Comments
 (0)