From 6afd36cb36ce9647ea999fa1e43337a53474538a Mon Sep 17 00:00:00 2001 From: Rijesh Augustine Date: Mon, 11 Aug 2025 17:18:44 -0600 Subject: [PATCH] Fixing release workflow --- .github/workflows/prerelease-vscode.yml | 30 ------------ .github/workflows/release.yml | 61 +++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 30 deletions(-) delete mode 100644 .github/workflows/prerelease-vscode.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/prerelease-vscode.yml b/.github/workflows/prerelease-vscode.yml deleted file mode 100644 index 88f0c58..0000000 --- a/.github/workflows/prerelease-vscode.yml +++ /dev/null @@ -1,30 +0,0 @@ -on: - push: - branches: - - develop -name: Push Extension Prerelease -jobs: - deploy: - runs-on: ubuntu-latest - permissions: - contents: read - id-token: write - steps: - - uses: actions/checkout@v4 - - name: Use Node.js '20.x' - uses: actions/setup-node@v4 - with: - node-version: "20.x" - cache: "npm" - - run: npm ci - - run: npm --prefix server ci - - run: npm --prefix client ci - - run: npm version patch --no-git-tag-version - - uses: lannonbr/vsce-action@4.0.0 - with: - args: "publish --pre-release -p $VSCE_TOKEN" - env: - VSCE_TOKEN: ${{ secrets.VSCE_TOKEN }} - - run: | - VERSION=$(node -p "require('./package.json').version") - gh release create "v$VERSION" --prerelease --title "Prerelease $VERSION" -p "*.vsix" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..01689e4 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,61 @@ +# 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 + + # Step 4: Handle prerelease logic for pushes to 'develop'. + - name: Publish Prerelease + if: github.ref == 'refs/heads/develop' + uses: HaaLeo/publish-vscode-extension@v2 + with: + pat: ${{ env.publish_token }} + ovsxPat: ${{ env.ovsx_token }} + githubToken: ${{ secrets.GITHUB_TOKEN }} + preRelease: true + updateRelease: true + + # Step 5: Handle official release logic for pushes to 'main'. + - name: Publish Official Release + if: github.ref == 'refs/heads/main' + uses: HaaLeo/publish-vscode-extension@v2 + with: + pat: ${{ env.publish_token }} + ovsxPat: ${{ env.ovsx_token }} + githubToken: ${{ secrets.GITHUB_TOKEN }} + preRelease: false + updateRelease: true