Skip to content

Add GitHub Actions workflow for building VSCode extensions #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 17, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 94 additions & 0 deletions .github/workflows/build-extensions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Build VSCode Extensions

on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
workflow_dispatch:
inputs:
force_rebuild:
description: 'Force rebuild even if no changes detected'
required: false
default: false
type: boolean

jobs:
build-extensions:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Install vsce globally
run: npm install -g @vscode/vsce

- name: Build tutorial extension
run: |
echo "Building tutorial extension..."
npm run buildExtension

- name: Build theme extension
run: |
echo "Building theme extension..."
cd themes && npx @vscode/vsce package --out ../zenml-color-theme.vsix

- name: Verify extensions were built
run: |
echo "Checking built extensions..."
if [ -d ".devcontainer/extensions" ]; then
echo "Tutorial extension files:"
ls -la .devcontainer/extensions/
else
echo "ERROR: .devcontainer/extensions directory not found"
exit 1
fi

if [ -f "zenml-color-theme.vsix" ]; then
echo "Theme extension built successfully:"
ls -la zenml-color-theme.vsix
else
echo "ERROR: zenml-color-theme.vsix not found"
exit 1
fi

- name: Upload tutorial extension artifact
uses: actions/upload-artifact@v4
with:
name: tutorial-extension
path: .devcontainer/extensions/zenml-codespace-tutorial-*.vsix

- name: Upload theme extension artifact
uses: actions/upload-artifact@v4
with:
name: theme-extension
path: zenml-color-theme.vsix

- name: Commit and push built extensions
# Only commit on push to main/develop branches, not on PRs
if: github.event_name == 'push' || github.event.inputs.force_rebuild
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"

# Add the built extensions to git
git add .devcontainer/extensions/zenml-codespace-tutorial-*.vsix
git add zenml-color-theme.vsix

# Check if there are any changes to commit
if git diff --staged --quiet; then
echo "No changes to commit"
else
git commit -m "Auto-build extensions [skip ci]"
git push
fi
Loading