name: release-plugin
on:
push:
tags:
- 'opencode-v*'
jobs:
publish:
runs-on: ubuntu-latest
environment: release
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '24'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: cd agents/opencode/plugin && npm ci
- name: Build
run: cd agents/opencode/plugin && npm run build --if-present
- name: Extract version from tag
id: version
shell: bash
run: |
set -euo pipefail
echo "VERSION=${TAG#opencode-v}" >> "$GITHUB_OUTPUT"
env:
TAG: ${{ github.ref_name }}
- name: Update package.json version
shell: bash
run: |
set -euo pipefail
cd agents/opencode/plugin
current=$(node -p "require('./package.json').version")
target='${{ steps.version.outputs.VERSION }}'
if [ "$current" = "$target" ]; then
echo "package.json already at version $target"
exit 0
fi
npm version "$target" --no-git-tag-version
- name: Publish to npm
run: cd agents/opencode/plugin && npm publish --access public