From 91879669d716cef8b3c2b0d01823bce635afc207 Mon Sep 17 00:00:00 2001 From: "gitricko@hermes" Date: Sat, 23 May 2026 00:23:11 -0400 Subject: [PATCH 01/10] ci-setup --- .github/workflows/pr-build.yml | 41 +++++++++++++ .github/workflows/release.yml | 62 +++++++++++++++++++ CI-SETUP.md | 105 +++++++++++++++++++++++++++++++++ package.json | 3 +- 4 files changed, 210 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/pr-build.yml create mode 100644 .github/workflows/release.yml create mode 100644 CI-SETUP.md diff --git a/.github/workflows/pr-build.yml b/.github/workflows/pr-build.yml new file mode 100644 index 0000000..6e28290 --- /dev/null +++ b/.github/workflows/pr-build.yml @@ -0,0 +1,41 @@ +# PR Build — Generate VSIX artifact for manual testing +# Triggers on every pull request to main. +# Produces a .vsix file uploaded as a build artifact +# so reviewers can download and install it in VS Code. + +name: PR Build — VSIX + +on: + pull_request: + branches: [main] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node.js 20 + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + + - name: Install dependencies + run: npm ci + + - name: Build extension (webpack) + run: npm run build + + - name: Package VSIX + run: npm run package + + - name: Upload VSIX artifact + uses: actions/upload-artifact@v4 + with: + name: hermes-vscode-vsix + path: hermes-*.vsix + retention-days: 14 + if-no-files-found: error diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..061b42c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,62 @@ +# Release — Build and package to GitHub Releases +# Triggers on push to main. +# Produces a .vsix, creates a GitHub Release with the artifact attached. + +name: Release + +on: + push: + branches: [main] + +jobs: + publish: + runs-on: ubuntu-latest + permissions: + contents: write # for creating GitHub Releases + packages: write # for GitHub Packages (if used later) + attestations: write # for artifact attestation + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node.js 20 + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + + - name: Install dependencies + run: npm ci + + - name: Build extension (webpack) + run: npm run build + + - name: Package VSIX + run: npm run package + + # Extract version from package.json for release tag + - name: Extract version + id: version + run: echo "tag=v$(jq -r '.version' package.json)" >> $GITHUB_OUTPUT + + # Upload VSIX as an artifact (for archival) + - name: Upload VSIX artifact + uses: actions/upload-artifact@v4 + with: + name: hermes-vscode-vsix + path: hermes-*.vsix + retention-days: 90 + if-no-files-found: error + + # Create GitHub Release with VSIX attached + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ steps.version.outputs.tag }} + name: Hermes VS Code ${{ steps.version.outputs.tag }} + files: hermes-*.vsix + generate_release_notes: true + fail_on_unmatched_files: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/CI-SETUP.md b/CI-SETUP.md new file mode 100644 index 0000000..4044d15 --- /dev/null +++ b/CI-SETUP.md @@ -0,0 +1,105 @@ +# CI/CD Setup for hermes-vscode + +This document describes the GitHub Actions workflows and required secrets. + +## Workflows + +### 1. PR Build (`.github/workflows/pr-build.yml`) + +- Triggers on every pull request to `main`. +- Runs on `ubuntu-latest`. +- Steps: + - Checkout + - Setup Node.js 20 (with npm cache) + - `npm ci` (clean install) + - `npm run build` (webpack production) + - `npm run package` (vsce package → `.vsix`) + - Upload VSIX as a build artifact (retained 14 days) + +**Purpose:** Provide PR reviewers with a downloadable VSIX to manually install and test the extension. + +Artifact name: `hermes-vscode-vsix` (download from the PR's "Artifacts" section). + +--- + +### 2. Release (`.github/workflows/release.yml`) + +- Triggers on push to `main`. +- Runs on `ubuntu-latest`. +- Permissions: `contents: write`, `packages: write`, `attestations: write`. +- Steps: + - Same build/packaging steps as PR + - Extract version from `package.json` → `vX.Y.Z` + - Upload VSIX as artifact (retained 90 days) + - **Always** create a GitHub Release with that tag and attach the VSIX + +Note: Automatic publishing to the VS Code Marketplace is **not** configured. If you want CI to publish to the marketplace, add a step and the `VSCE_TOKEN` secret. + +--- + +## Secrets Configuration + +Add these secrets in **GitHub Repo Settings → Secrets and variables → Actions**: + +| Secret | Required? | Description | +|--------|-----------|-------------| +| `GITHUB_TOKEN` | No (auto-provided) | Automatically provided by GitHub Actions. Used for creating releases and publishing packages. No manual setup needed. | + +No other secrets are required for the current CI configuration. + +--- + +## Manual Publishing to VS Code Marketplace (Optional) + +If you want to publish manually: + +1. Run locally: `npm run publish` (requires `VSCE_TOKEN` in env) +2. To get a token: https://aka.ms/vscode-vsce +3. Set env var: `VSCE_TOKEN=your_token npm run publish` + +Or add a marketplace publish step back into `release.yml` if desired. + +--- + +## Manual Testing from PR Artifacts + +1. Open the PR on GitHub. +2. In the "Checks" section, find the "PR Build — VSIX" workflow. +3. Click "Artifacts" → download `hermes-vscode-vsix.zip`. +4. Extract `.vsix` file. +5. In VS Code: Extensions view → `...` → "Install from VSIX..." → select the file. +6. Verify functionality. + +--- + +## Version Bumping + +Before merging a PR that should be a new release, bump the `version` in `package.json`. The release workflow reads that version to create both: +- The GitHub release tag (`v3.0.0`, `v3.1.0`, etc.) +- The attached VSIX filename (`hermes-ai-agent-3.0.0.vsix`) + +Follow semantic versioning: +- Patch: bugfixes only (x.y.Z) +- Minor: new features (x.Y.0) +- Major: breaking changes (X.0.0) + +--- + +## Troubleshooting + +**Workflow fails at `npm ci`?** +- Check `package-lock.json` is present and up-to-date. If not, run `npm install` locally and commit the updated lockfile. + +**VSIX artifact not generated?** +- Ensure `npm run package` completes successfully. The script uses `vsce package --no-dependencies`. The `@vscode/vsce` dependency is in `devDependencies` and will be installed by `npm ci`. + +**Release creation fails?** +- Verify the `GITHUB_TOKEN` has `contents: write` permission (default in most repos). The workflow sets `permissions` appropriately. + +--- + +## Notes + +- The workflows do not run on forks unless the fork's Actions are enabled. +- Because we use `upload-artifact` on PRs, artifacts are stored for 14 days. GitHub retention limits apply depending on your plan. +- If you later decide to publish to the VS Code Marketplace via CI, add the `VSCE_TOKEN` secret and a publish step analogous to the one previously provided. diff --git a/package.json b/package.json index a45dd89..fc780b9 100644 --- a/package.json +++ b/package.json @@ -102,7 +102,8 @@ "vscode:prepublish": "npm run build", "build": "webpack --mode production", "dev": "webpack --mode development --watch", - "package": "vsce package --no-dependencies" + "package": "vsce package --no-dependencies", + "publish": "vsce publish --no-dependencies --pat $VSCE_TOKEN" }, "devDependencies": { "@types/dompurify": "^3.0.5", From 53a1c5d7abb615a3103913643bad12232a58c8b8 Mon Sep 17 00:00:00 2001 From: gitricko Date: Sat, 23 May 2026 00:33:46 -0400 Subject: [PATCH 02/10] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- CI-SETUP.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CI-SETUP.md b/CI-SETUP.md index 4044d15..d6910b3 100644 --- a/CI-SETUP.md +++ b/CI-SETUP.md @@ -33,6 +33,8 @@ Artifact name: `hermes-vscode-vsix` (download from the PR's "Artifacts" section) - Upload VSIX as artifact (retained 90 days) - **Always** create a GitHub Release with that tag and attach the VSIX +Warning: Before pushing to `main`, make sure `package.json`'s `version` has been bumped if you expect a new release. The workflow derives the release tag directly from that version, so pushing again with the same version will try to reuse the existing `vX.Y.Z` tag/release. In that case, the release step will typically fail or create a noisy duplicate-release attempt rather than producing a new versioned release. + Note: Automatic publishing to the VS Code Marketplace is **not** configured. If you want CI to publish to the marketplace, add a step and the `VSCE_TOKEN` secret. --- From 9122d60207f13efef9d2ae89fcf52efa2844f287 Mon Sep 17 00:00:00 2001 From: gitricko Date: Sat, 23 May 2026 00:38:39 -0400 Subject: [PATCH 03/10] chore: fix typo in CI-SETUP.md header --- CI-SETUP.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI-SETUP.md b/CI-SETUP.md index d6910b3..2534c8c 100644 --- a/CI-SETUP.md +++ b/CI-SETUP.md @@ -2,7 +2,7 @@ This document describes the GitHub Actions workflows and required secrets. -## Workflows +## Workflows. ### 1. PR Build (`.github/workflows/pr-build.yml`) From a291ebe87832054bb7c4f328c202d8879459950e Mon Sep 17 00:00:00 2001 From: gitricko Date: Sat, 23 May 2026 12:54:05 +0800 Subject: [PATCH 04/10] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- CI-SETUP.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI-SETUP.md b/CI-SETUP.md index 2534c8c..f190001 100644 --- a/CI-SETUP.md +++ b/CI-SETUP.md @@ -45,7 +45,7 @@ Add these secrets in **GitHub Repo Settings → Secrets and variables → Action | Secret | Required? | Description | |--------|-----------|-------------| -| `GITHUB_TOKEN` | No (auto-provided) | Automatically provided by GitHub Actions. Used for creating releases and publishing packages. No manual setup needed. | +| `GITHUB_TOKEN` | No (auto-provided) | Automatically provided by GitHub Actions. Used for creating GitHub Releases. No manual setup needed. | No other secrets are required for the current CI configuration. From c81035796df09d922a6d0b9478ed37fd0799bdce Mon Sep 17 00:00:00 2001 From: gitricko Date: Sat, 23 May 2026 12:54:19 +0800 Subject: [PATCH 05/10] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- CI-SETUP.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI-SETUP.md b/CI-SETUP.md index f190001..63552e8 100644 --- a/CI-SETUP.md +++ b/CI-SETUP.md @@ -2,7 +2,7 @@ This document describes the GitHub Actions workflows and required secrets. -## Workflows. +## Workflows ### 1. PR Build (`.github/workflows/pr-build.yml`) From a5e223a84483e707a416da89432b8c40b0728ec1 Mon Sep 17 00:00:00 2001 From: gitricko Date: Sat, 23 May 2026 12:55:20 +0800 Subject: [PATCH 06/10] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .github/workflows/pr-build.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/pr-build.yml b/.github/workflows/pr-build.yml index 6e28290..c2ff5bf 100644 --- a/.github/workflows/pr-build.yml +++ b/.github/workflows/pr-build.yml @@ -26,9 +26,6 @@ jobs: - name: Install dependencies run: npm ci - - name: Build extension (webpack) - run: npm run build - - name: Package VSIX run: npm run package From b6855c47fe84ff887f3eaa28c4a226829b89c0d4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 23 May 2026 04:57:52 +0000 Subject: [PATCH 07/10] Add check to fail build if release tag already exists --- .github/workflows/release.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 061b42c..d1ac2c6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -40,6 +40,17 @@ jobs: id: version run: echo "tag=v$(jq -r '.version' package.json)" >> $GITHUB_OUTPUT + # Fail if tag already exists + - name: Check if tag exists + run: | + tag="${{ steps.version.outputs.tag }}" + if gh release view "$tag" > /dev/null 2>&1; then + echo "Error: Release tag $tag already exists" + exit 1 + fi + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Upload VSIX as an artifact (for archival) - name: Upload VSIX artifact uses: actions/upload-artifact@v4 From 59dcd55509f2fbb529a7e5d3c86a43b8325916ab Mon Sep 17 00:00:00 2001 From: gitricko Date: Sat, 23 May 2026 13:05:15 +0800 Subject: [PATCH 08/10] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .github/workflows/release.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d1ac2c6..157e9b6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,9 +29,6 @@ jobs: - name: Install dependencies run: npm ci - - name: Build extension (webpack) - run: npm run build - - name: Package VSIX run: npm run package From 3d46dd05f91a5773fda18a7c0993cdf9de624e9c Mon Sep 17 00:00:00 2001 From: gitricko Date: Sat, 23 May 2026 13:06:35 +0800 Subject: [PATCH 09/10] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fc780b9..9e74a1b 100644 --- a/package.json +++ b/package.json @@ -103,7 +103,7 @@ "build": "webpack --mode production", "dev": "webpack --mode development --watch", "package": "vsce package --no-dependencies", - "publish": "vsce publish --no-dependencies --pat $VSCE_TOKEN" + "vsce:publish": "vsce publish --no-dependencies" }, "devDependencies": { "@types/dompurify": "^3.0.5", From b774f9614e7a1b1dc0d0e8580004bbfe38c99480 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 23 May 2026 05:17:54 +0000 Subject: [PATCH 10/10] fix: fail release on existing tag --- .github/workflows/release.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 157e9b6..ad65be8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -37,16 +37,14 @@ jobs: id: version run: echo "tag=v$(jq -r '.version' package.json)" >> $GITHUB_OUTPUT - # Fail if tag already exists - - name: Check if tag exists + # Fail if version tag already exists + - name: Check if version tag exists run: | tag="${{ steps.version.outputs.tag }}" - if gh release view "$tag" > /dev/null 2>&1; then - echo "Error: Release tag $tag already exists" + if git ls-remote --exit-code --tags origin "refs/tags/$tag" > /dev/null 2>&1; then + echo "Error: Version tag $tag already exists" exit 1 fi - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Upload VSIX as an artifact (for archival) - name: Upload VSIX artifact