This guide covers how to test and deploy your VS Code extension to the marketplace.
The repository includes two GitHub Actions workflows:
test-package.yml: Runs on every push/PR to test packaging without publishingrelease.yml: Runs on tag push to publish to marketplace and create GitHub release
Before creating a release, you should test the extension locally:
# Install dependencies
npm ci
# Run linting
npm run lint
# Compile TypeScript
npm run compile
# Test packaging
npm run package
# Install the extension locally for testing
code --install-extension ./elastic-docs-v3-utilities-*.vsixBefore creating a release tag:
- Update version in
package.json - Update
CHANGELOG.mdor release notes - Test the extension locally
- Ensure all tests pass
- Verify the
publisherfield matches your marketplace publisher ID - Confirm
VSCE_PATsecret is set and valid
-
Update version: Increment the version in
package.json:{ "version": "1.2.3" } -
Commit changes:
git add package.json git commit -m "Bump version to 1.2.3" git push origin main
# Create the tag (must start with 'v')
git tag v1.2.3
# Push the tag to trigger the release workflow
git push origin v1.2.3- Go to your GitHub repository's "Actions" tab
- Watch the "Release" workflow execution
- The workflow will:
- ✅ Build and compile the extension
- ✅ Validate version consistency between tag and package.json
- ✅ Package the extension
- ✅ Publish to VS Code Marketplace
- ✅ Create a GitHub release with the
.vsixfile
-
Check VS Code Marketplace:
- Go to https://marketplace.visualstudio.com/items?itemName=elastic.elastic-docs-v3-utilities
- Verify the new version is available
-
Check GitHub release:
- Go to your repository's "Releases" page
- Verify the new release was created with the
.vsixfile attached
-
Test installation:
# Install from marketplace code --install-extension elastic.elastic-docs-v3-utilities
-
Version mismatch error:
Error: package.json version (1.2.2) doesn't match tag version (1.2.3)Solution: Update
package.jsonversion to match your tag, or create a new tag with the correct version. -
Authentication error:
Error: Failed to publish. Check your credentials.Solution:
- Verify
VSCE_PATsecret is set in GitHub repository settings - Check if your Personal Access Token has expired
- Ensure the PAT has "Marketplace Manage" permissions
- Verify
-
Publisher mismatch:
Error: Extension publisher 'your-publisher' doesn't match expected 'elastic'Solution: Update the
publisherfield inpackage.jsonto match your marketplace publisher ID. -
Package not found:
Error: Package file not found: ./elastic-docs-v3-utilities-1.2.3.vsixSolution: This usually indicates the packaging step failed. Check the build logs for compilation errors.
If the automated publishing fails, you can publish manually:
# Install vsce globally
npm install -g @vscode/vsce
# Build and package
npm ci
npm run compile
vsce package
# Publish to marketplace
vsce publish --packagePath ./elastic-docs-v3-utilities-*.vsixIf you need to unpublish or rollback a version:
-
Unpublish from marketplace (use cautiously):
vsce unpublish elastic.elastic-docs-v3-utilities@1.2.3
-
Delete GitHub release:
- Go to repository's "Releases" page
- Click on the release
- Click "Delete this release"
-
Delete git tag:
git tag -d v1.2.3 git push --delete origin v1.2.3
| Variable | Description | Required |
|---|---|---|
VSCE_PAT |
Personal Access Token for VS Code Marketplace | Yes |
The release workflow requires these permissions:
contents: write- To create GitHub releases- Access to repository secrets for
VSCE_PAT
- Semantic versioning: Use semantic versioning (major.minor.patch)
- Test thoroughly: Always test locally before releasing
- Release notes: Include meaningful release notes
- Security: Regularly rotate your Personal Access Token
- Monitoring: Monitor the marketplace page after releases
- Backup: Keep local copies of
.vsixfiles for important releases