Skip to content

Commit 9f48d7a

Browse files
leohenongithub-actions[bot]
authored andcommitted
ci(vim): switch to github releases
1 parent c5b8ed2 commit 9f48d7a

28 files changed

Lines changed: 86 additions & 3718 deletions

.github/workflows/publish-vim.yml

Lines changed: 23 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
name: Publish ocvim
1+
name: Release ocvim
22

33
on:
44
workflow_dispatch:
55
inputs:
66
version:
7-
description: "Version to publish (e.g. 1.0.0)"
7+
description: "Version (e.g. 1.2.20)"
88
required: true
99
type: string
1010

@@ -21,76 +21,44 @@ jobs:
2121

2222
- uses: oven-sh/setup-bun@v2
2323

24-
- uses: actions/setup-node@v4
25-
with:
26-
node-version: "24"
27-
registry-url: "https://registry.npmjs.org"
28-
2924
- name: Install dependencies
3025
run: bun install
3126

3227
- name: Build CLI
33-
run: bun run packages/opencode/script/build.ts
28+
run: bun run packages/opencode/script/build.ts --single=false
3429
env:
3530
OPENCODE_VERSION: ${{ inputs.version }}
3631

37-
- name: Publish platform packages
32+
- name: Package binaries
3833
shell: bash
3934
run: |
40-
VERSION="${{ inputs.version }}"
4135
DIST="packages/opencode/dist"
36+
mkdir -p "$DIST/release"
4237
4338
for dir in $DIST/opencode-*/; do
4439
[ -d "$dir" ] || continue
45-
original=$(jq -r .name "$dir/package.json")
46-
new_name="${original/opencode/ocvim}"
47-
jq --arg name "$new_name" --arg ver "$VERSION" \
48-
'.name = $name | .version = $ver' "$dir/package.json" > "$dir/package.json.tmp"
49-
mv "$dir/package.json.tmp" "$dir/package.json"
50-
echo "Publishing $new_name@$VERSION"
51-
npm publish "$dir" --access public --tag latest-vim || echo "Skipping $new_name (already published)"
52-
sleep 30
40+
name=$(basename "$dir")
41+
target="${name/opencode/ocvim}"
42+
43+
if [[ "$name" == *linux* ]]; then
44+
tar -czf "$DIST/release/$target.tar.gz" -C "$dir/bin" .
45+
else
46+
(cd "$dir/bin" && zip -r "../../release/$target.zip" .)
47+
fi
5348
done
54-
env:
55-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
5649
57-
- name: Publish wrapper package
50+
ls -lh "$DIST/release/"
51+
52+
- name: Create GitHub Release
5853
shell: bash
5954
run: |
6055
VERSION="${{ inputs.version }}"
61-
DIST="packages/opencode/dist"
62-
WRAPPER="$DIST/wrapper"
63-
mkdir -p "$WRAPPER/bin"
64-
65-
# Patch bin wrapper to use ocvim- prefix for platform packages
66-
sed 's/const base = "opencode-"/const base = "ocvim-"/' \
67-
packages/opencode/bin/opencode > "$WRAPPER/bin/opencode-vim"
68-
chmod +x "$WRAPPER/bin/opencode-vim"
69-
70-
# Patch postinstall to use ocvim- prefix
71-
sed 's/`opencode-/`ocvim-/g; s/"opencode"/"ocvim"/g' \
72-
packages/opencode/script/postinstall.mjs > "$WRAPPER/postinstall.mjs"
73-
74-
# Collect platform package names for optionalDependencies
75-
OPT_DEPS=$(for dir in $DIST/opencode-*/; do
76-
[ -d "$dir" ] || continue
77-
jq -r '.name' "$dir/package.json"
78-
done | jq -R -s --arg ver "$VERSION" \
79-
'split("\n") | map(select(length > 0)) | map({(.): $ver}) | add')
80-
81-
# Write package.json
82-
jq -n --arg ver "$VERSION" --argjson deps "$OPT_DEPS" '{
83-
name: "opencode-vim",
84-
version: $ver,
85-
license: "MIT",
86-
bin: { ocvim: "./bin/opencode-vim" },
87-
scripts: { postinstall: "bun ./postinstall.mjs || node ./postinstall.mjs" },
88-
optionalDependencies: $deps
89-
}' > "$WRAPPER/package.json"
90-
91-
cat "$WRAPPER/package.json"
56+
DIST="packages/opencode/dist/release"
9257
93-
echo "Publishing opencode-vim@$VERSION"
94-
npm publish "$WRAPPER" --access public --tag latest-vim
58+
gh release create "v$VERSION" \
59+
--title "ocvim v$VERSION" \
60+
--notes "Based on opencode v$VERSION with vim mode enabled by default." \
61+
--repo "$GITHUB_REPOSITORY" \
62+
"$DIST"/*
9563
env:
96-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
64+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

AGENTS.md

Lines changed: 0 additions & 124 deletions
This file was deleted.

0 commit comments

Comments
 (0)