Skip to content

Update release.yml

Update release.yml #9

Workflow file for this run

# This workflow automates the release process for a VS Code extension.
# It runs on pushes to the 'develop' and 'main' branches.
# The version number must be manually updated in the package.json file before pushing.
name: Release VS Code Extension
on:
push:
branches:
- develop
- main
jobs:
release:
# Set the runner environment.
runs-on: ubuntu-latest
# Define environment variables for the release process
# Note: The HaaLeo action uses different secret names.
# The 'publish_token' is for VS Code Marketplace, and 'ovsx_token' is for Open VSX.
env:
publish_token: ${{ secrets.VSCE_TOKEN }}
ovsx_token: ${{ secrets.OPEN_VSIX_TOKEN }}
steps:
# Step 1: Checkout the repository code.
- name: Checkout Repository
uses: actions/checkout@v4
# Step 2: Set up Node.js environment.
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20.x" # Use a stable Node.js version.
cache: "npm"
# Step 3: Install project dependencies.
- name: Install Dependencies
run: npm ci
# Optional build (ensure dist/extension.js exists if using bundler)
- name: Build Extension
run: npm run esbuild --if-present
# Step 4: Handle prerelease logic for pushes to 'develop'.
- name: Publish Prerelease to Open VSX
if: github.ref == 'refs/heads/develop'
id: prereleaseOpenVsx
continue-on-error: true
uses: HaaLeo/publish-vscode-extension@v2
with:
pat: ${{ env.ovsx_token }}
preRelease: true
- name: Note Open VSX prerelease failure (non-blocking)
if: github.ref == 'refs/heads/develop' && steps.prereleaseOpenVsx.outcome == 'failure'
run: echo "Warning: Open VSX prerelease publish failed; proceeding to VS Marketplace publish anyway."

Check failure on line 57 in .github/workflows/release.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/release.yml

Invalid workflow file

You have an error in your yaml syntax on line 57
- name: Publish Prerelease to VS Marketplace (vsce)
if: github.ref == 'refs/heads/develop'
uses: lannonbr/vsce-action@4.0.0
env:
VSCE_TOKEN: ${{ env.publish_token }}
with:
args: publish --pre-release -p $VSCE_TOKEN