From 03f7f182605d178aa6e3b3533d76eb0a6361940f Mon Sep 17 00:00:00 2001 From: Aiden Cline Date: Wed, 5 Nov 2025 09:36:38 -0600 Subject: ci: adjust auto label --- .github/workflows/auto-label-tui.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to '.github') diff --git a/.github/workflows/auto-label-tui.yml b/.github/workflows/auto-label-tui.yml index 834562e17..73cccf928 100644 --- a/.github/workflows/auto-label-tui.yml +++ b/.github/workflows/auto-label-tui.yml @@ -20,8 +20,8 @@ jobs: const title = issue.title; const description = issue.body || ''; - // Check for web/desktop keywords - const webPattern = /\b(web|desktop)\b/i; + // Check for "opencode web" or desktop keywords + const webPattern = /(opencode web|\bdesktop\b)/i; const isWebRelated = webPattern.test(title) || webPattern.test(description); // Check for version patterns like v1.0.x or 1.0.x -- cgit v1.2.3 From d8bcf1f5f3923f6130cd8be02b67a565da1dfa19 Mon Sep 17 00:00:00 2001 From: Aiden Cline Date: Thu, 6 Nov 2025 11:46:42 -0600 Subject: ci: update auto label --- .github/workflows/auto-label-tui.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to '.github') diff --git a/.github/workflows/auto-label-tui.yml b/.github/workflows/auto-label-tui.yml index 73cccf928..8f2d80b59 100644 --- a/.github/workflows/auto-label-tui.yml +++ b/.github/workflows/auto-label-tui.yml @@ -20,8 +20,8 @@ jobs: const title = issue.title; const description = issue.body || ''; - // Check for "opencode web" or desktop keywords - const webPattern = /(opencode web|\bdesktop\b)/i; + // Check for "opencode web" keyword + const webPattern = /(opencode web)/i; const isWebRelated = webPattern.test(title) || webPattern.test(description); // Check for version patterns like v1.0.x or 1.0.x -- cgit v1.2.3 From 58bbe9e689d4ae99e18cea4e0bdd40599643c427 Mon Sep 17 00:00:00 2001 From: Dax Raad Date: Fri, 7 Nov 2025 15:58:51 -0500 Subject: ci: add optional version parameter to publish workflow Allows overriding the version when publishing releases instead of only using semantic bumping. This gives maintainers more control over release versioning for special cases or hotfixes. --- .github/workflows/publish.yml | 5 +++++ 1 file changed, 5 insertions(+) (limited to '.github') diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index df1a36f77..a339c7dab 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -12,6 +12,10 @@ on: - major - minor - patch + version: + description: "Override version (optional)" + required: false + type: string concurrency: ${{ github.workflow }}-${{ github.ref }} @@ -62,6 +66,7 @@ jobs: ./script/publish.ts env: OPENCODE_BUMP: ${{ inputs.bump }} + OPENCODE_VERSION: ${{ inputs.version }} OPENCODE_CHANNEL: latest NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }} GITHUB_TOKEN: ${{ secrets.SST_GITHUB_TOKEN }} -- cgit v1.2.3 From cfbbdc2e14099de6994a07514cca94d97a51662d Mon Sep 17 00:00:00 2001 From: Aiden Cline Date: Sat, 8 Nov 2025 23:23:43 -0600 Subject: ci: add job to sync zed extension --- .github/workflows/sync-zed-extension.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .github/workflows/sync-zed-extension.yml (limited to '.github') diff --git a/.github/workflows/sync-zed-extension.yml b/.github/workflows/sync-zed-extension.yml new file mode 100644 index 000000000..d0856cd3b --- /dev/null +++ b/.github/workflows/sync-zed-extension.yml @@ -0,0 +1,16 @@ +on: + push: + tags: + - "v*" + +jobs: + zed: + name: Release Zed Extension + runs-on: ubuntu-latest + steps: + - uses: huacnlee/zed-extension-action@6a168731f1d994905eeb552b3b42b0cb6c4d12e6 + with: + extension-name: opencode + push-to: sst/zed-extensions + env: + COMMITTER_TOKEN: ${{ secrets.SST_GITHUB_TOKEN }} -- cgit v1.2.3 From 6e5971dff22490713e89b1e69e6078ab0fc158de Mon Sep 17 00:00:00 2001 From: Aiden Cline Date: Sun, 9 Nov 2025 00:01:13 -0600 Subject: ci: update sync zed --- .github/workflows/sync-zed-extension.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to '.github') diff --git a/.github/workflows/sync-zed-extension.yml b/.github/workflows/sync-zed-extension.yml index d0856cd3b..e15942ac3 100644 --- a/.github/workflows/sync-zed-extension.yml +++ b/.github/workflows/sync-zed-extension.yml @@ -1,7 +1,10 @@ +name: "sync-zed-extension" + on: + workflow_dispatch: push: tags: - - "v*" + - "v[0-9]+.*" jobs: zed: -- cgit v1.2.3 From 92f7c4943f5fc823f6669ce560dca3387c3e1611 Mon Sep 17 00:00:00 2001 From: Aiden Cline Date: Sun, 9 Nov 2025 11:59:00 -0600 Subject: ci: zed sync --- .github/workflows/sync-zed-extension.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to '.github') diff --git a/.github/workflows/sync-zed-extension.yml b/.github/workflows/sync-zed-extension.yml index e15942ac3..e46b1f8cc 100644 --- a/.github/workflows/sync-zed-extension.yml +++ b/.github/workflows/sync-zed-extension.yml @@ -2,9 +2,8 @@ name: "sync-zed-extension" on: workflow_dispatch: - push: - tags: - - "v[0-9]+.*" + release: + types: [published] jobs: zed: @@ -15,5 +14,6 @@ jobs: with: extension-name: opencode push-to: sst/zed-extensions + tag-name: ${{ github.event.release.tag_name }} env: COMMITTER_TOKEN: ${{ secrets.SST_GITHUB_TOKEN }} -- cgit v1.2.3 From 905c034885b38a6761998595e338305b9ff4c6f8 Mon Sep 17 00:00:00 2001 From: Aiden Cline Date: Sun, 9 Nov 2025 12:00:08 -0600 Subject: ci: zed sync --- .github/workflows/sync-zed-extension.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to '.github') diff --git a/.github/workflows/sync-zed-extension.yml b/.github/workflows/sync-zed-extension.yml index e46b1f8cc..f8ffe8735 100644 --- a/.github/workflows/sync-zed-extension.yml +++ b/.github/workflows/sync-zed-extension.yml @@ -10,10 +10,23 @@ jobs: name: Release Zed Extension runs-on: ubuntu-latest steps: + - uses: actions/checkout@v4 + if: github.event_name == 'workflow_dispatch' + with: + fetch-depth: 0 + + - name: Get latest version tag + if: github.event_name == 'workflow_dispatch' + id: get_tag + run: | + TAG=$(git tag --list 'v[0-9]*.*' --sort=-version:refname | head -n 1) + echo "tag=${TAG}" >> $GITHUB_OUTPUT + echo "Using tag: ${TAG}" + - uses: huacnlee/zed-extension-action@6a168731f1d994905eeb552b3b42b0cb6c4d12e6 with: extension-name: opencode push-to: sst/zed-extensions - tag-name: ${{ github.event.release.tag_name }} + tag-name: ${{ github.event.release.tag_name || steps.get_tag.outputs.tag }} env: COMMITTER_TOKEN: ${{ secrets.SST_GITHUB_TOKEN }} -- cgit v1.2.3 From 888761645751f5e3916567c0447df98274df1187 Mon Sep 17 00:00:00 2001 From: Aiden Cline Date: Sun, 9 Nov 2025 12:47:36 -0600 Subject: ci: sync zed --- .github/workflows/sync-zed-extension.yml | 22 ++++--- script/sync-zed.ts | 106 +++++++++++++++++++++++++++++++ 2 files changed, 118 insertions(+), 10 deletions(-) create mode 100644 script/sync-zed.ts (limited to '.github') diff --git a/.github/workflows/sync-zed-extension.yml b/.github/workflows/sync-zed-extension.yml index f8ffe8735..c9dea7bb7 100644 --- a/.github/workflows/sync-zed-extension.yml +++ b/.github/workflows/sync-zed-extension.yml @@ -11,22 +11,24 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - if: github.event_name == 'workflow_dispatch' with: fetch-depth: 0 - - name: Get latest version tag - if: github.event_name == 'workflow_dispatch' + - uses: ./.github/actions/setup-bun + + - name: Get version tag id: get_tag run: | - TAG=$(git tag --list 'v[0-9]*.*' --sort=-version:refname | head -n 1) + if [ "${{ github.event_name }}" = "release" ]; then + TAG="${{ github.event.release.tag_name }}" + else + TAG=$(git tag --list 'v[0-9]*.*' --sort=-version:refname | head -n 1) + fi echo "tag=${TAG}" >> $GITHUB_OUTPUT echo "Using tag: ${TAG}" - - uses: huacnlee/zed-extension-action@6a168731f1d994905eeb552b3b42b0cb6c4d12e6 - with: - extension-name: opencode - push-to: sst/zed-extensions - tag-name: ${{ github.event.release.tag_name || steps.get_tag.outputs.tag }} + - name: Sync Zed extension + run: | + ./script/sync-zed.ts ${{ steps.get_tag.outputs.tag }} env: - COMMITTER_TOKEN: ${{ secrets.SST_GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.SST_GITHUB_TOKEN }} diff --git a/script/sync-zed.ts b/script/sync-zed.ts new file mode 100644 index 000000000..35d1b7539 --- /dev/null +++ b/script/sync-zed.ts @@ -0,0 +1,106 @@ +#!/usr/bin/env bun + +import { $ } from "bun" +import { tmpdir } from "os" +import { join } from "path" + +const FORK_REPO = "sst/zed-extensions" +const UPSTREAM_REPO = "zed-industries/extensions" +const EXTENSION_NAME = "opencode" +const OPENCODE_REPO = "sst/opencode" + +async function main() { + const version = process.argv[2] + if (!version) throw new Error("Version argument required: bun script/sync-zed.ts v1.0.52") + + const token = process.env.GITHUB_TOKEN + if (!token) throw new Error("GITHUB_TOKEN environment variable required") + + const cleanVersion = version.replace(/^v/, "") + console.log(`📦 Syncing Zed extension for version ${cleanVersion}`) + + // Get the commit SHA for this version tag + const commitSha = await $`git rev-parse ${version}`.text() + const sha = commitSha.trim() + console.log(`🔍 Found commit SHA: ${sha}`) + + // Read the extension.toml from this commit to verify version + const extensionToml = await $`git show ${version}:packages/extensions/zed/extension.toml`.text() + const parsed = Bun.TOML.parse(extensionToml) as { version: string } + const extensionVersion = parsed.version + + if (extensionVersion !== cleanVersion) { + throw new Error(`Version mismatch: extension.toml has ${extensionVersion} but tag is ${cleanVersion}`) + } + console.log(`✅ Version ${extensionVersion} matches tag`) + + // Clone the fork to a temp directory + const workDir = join(tmpdir(), `zed-extensions-${Date.now()}`) + console.log(`📁 Working in ${workDir}`) + + await $`git clone https://x-access-token:${token}@github.com/${FORK_REPO}.git ${workDir}` + process.chdir(workDir) + + // Sync fork with upstream + console.log(`🔄 Syncing fork with upstream...`) + await $`git remote add upstream https://github.com/${UPSTREAM_REPO}.git` + await $`git fetch upstream` + await $`git checkout main` + await $`git merge upstream/main --ff-only` + await $`git push origin main` + console.log(`✅ Fork synced`) + + // Create a new branch + const branchName = `update-${EXTENSION_NAME}-${cleanVersion}` + console.log(`🌿 Creating branch ${branchName}`) + await $`git checkout -b ${branchName}` + + // Update the submodule for opencode extension + const submodulePath = `extensions/${EXTENSION_NAME}` + console.log(`📌 Updating submodule to commit ${sha}`) + await $`git submodule update --init ${submodulePath}` + process.chdir(submodulePath) + await $`git fetch` + await $`git checkout ${sha}` + process.chdir(workDir) + await $`git add ${submodulePath}` + + // Update extensions.toml + console.log(`📝 Updating extensions.toml`) + const extensionsTomlPath = "extensions.toml" + const extensionsToml = await Bun.file(extensionsTomlPath).text() + + // Update version field for opencode extension + const versionRegex = new RegExp(`(\\[${EXTENSION_NAME}\\]\\s+(?:.*\\s*)?)version = "[^"]+"`) + const updatedToml = extensionsToml.replace(versionRegex, `$1version = "${cleanVersion}"`) + + await Bun.write(extensionsTomlPath, updatedToml) + await $`git add extensions.toml` + + // Commit changes + const commitMessage = `Update ${EXTENSION_NAME} to v${cleanVersion} + +Release notes: + +https://github.com/${OPENCODE_REPO}/releases/tag/v${cleanVersion}` + + await $`git commit -m ${commitMessage}` + console.log(`✅ Changes committed`) + + // Push to fork + console.log(`🚀 Pushing to fork...`) + await $`git push https://x-access-token:${token}@github.com/${FORK_REPO}.git ${branchName}` + + // Create PR using gh CLI + console.log(`📬 Creating pull request...`) + const prUrl = + await $`gh pr create --repo ${UPSTREAM_REPO} --base main --head ${FORK_REPO.split("/")[0]}:${branchName} --title "Update ${EXTENSION_NAME} to v${cleanVersion}" --body "Release notes:\n\nhttps://github.com/${OPENCODE_REPO}/releases/tag/v${cleanVersion}"`.text() + + console.log(`✅ Pull request created: ${prUrl}`) + console.log(`🎉 Done!`) +} + +main().catch((err) => { + console.error("❌ Error:", err.message) + process.exit(1) +}) -- cgit v1.2.3