blamouche_obsidian-any-ai-code/.github/workflows/release.yml
blamouche 8efbce2156 Strip release zip to the three canonical Obsidian plugin files
Since 0.1.46, main.js embeds pty-proxy.js and pty-bridge.py via esbuild
define and writes them next to the plugin on first Start. That makes
the zip-side copies redundant: the staging step previously bundled 8
files (`manifest.json`, `main.js`, `styles.css`, `versions.json`,
`pty-proxy.js`, `pty-bridge.py`, `package.json`, `package-lock.json`),
but only the three official ones actually need to end up in the plugin
folder for the panel to start.

Trim:

- Zip now contains only `manifest.json`, `main.js`, `styles.css` —
  the canonical Obsidian plugin folder layout.
- Standalone release assets keep the four files Obsidian's plugin
  update protocol and BRAT actually fetch: `manifest.json`, `main.js`,
  `styles.css`, `versions.json`.
- `versions.json` is no longer inside the zip — Obsidian fetches it
  directly from the release URL, not from the plugin folder.
- `package.json` / `package-lock.json` are no longer shipped at all
  (advanced users can download them from the repo for the matching
  tag if they want to opt into the native node-pty backend).

Reworked the release notes body to lead with the community-store
install path and document the embedded-source bootstrap. Aligned the
README `Release` and `Required files` sections with the new layout.

Bumped manifest/version metadata to 0.1.47.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 23:13:36 +02:00

105 lines
4 KiB
YAML

name: Release
on:
push:
tags:
- "*"
permissions:
contents: write
jobs:
build-and-release:
runs-on: ubuntu-latest
env:
PLUGIN_ID: any-ai-cli
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- name: Install
run: npm ci
- name: Build
run: npm run build
- name: Stage plugin bundle
run: |
set -e
STAGE_DIR="dist/${PLUGIN_ID}"
mkdir -p "${STAGE_DIR}"
# Only the canonical Obsidian plugin folder contents go in the zip.
# The auxiliary `pty-proxy.js` / `pty-bridge.py` sources are embedded
# inside `main.js` at build time and written next to the plugin on
# first start, so they don't need to ship separately.
for f in manifest.json main.js styles.css; do
if [ ! -f "$f" ]; then
echo "Missing required plugin file: $f"
exit 1
fi
cp "$f" "${STAGE_DIR}/"
done
- name: Create plugin zip
run: |
set -e
cd dist
zip -r "../${PLUGIN_ID}-${GITHUB_REF_NAME}.zip" "${PLUGIN_ID}"
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
name: ${{ github.ref_name }}
tag_name: ${{ github.ref_name }}
generate_release_notes: true
fail_on_unmatched_files: true
# Per Obsidian release guide, releases are created as drafts so the
# author can review release notes before publishing.
draft: true
body: |
## Install
**From the Obsidian community store** (recommended):
Open `Settings → Community plugins → Browse`, search for **Any AI CLI**, and click **Install** + **Enable**. The plugin's `main.js` embeds the Node proxy and Python PTY bridge sources and writes them next to itself on first start, so the standard three-file auto-install (`main.js` / `manifest.json` / `styles.css`) is enough.
**From this release** (manual install / pre-release testing):
1. Download `${{ env.PLUGIN_ID }}-${{ github.ref_name }}.zip` below.
2. Unzip it inside your vault's plugin folder so the resulting path is `/PATH/TO/VAULT/.obsidian/plugins/${{ env.PLUGIN_ID }}/`.
3. Enable the plugin in Obsidian → Settings → Community plugins.
No commands required. The plugin uses an embedded Python PTY bridge fallback so it works out of the box on macOS / Linux, and falls back to direct pipe mode on Windows.
### Optional — native PTY backend
For best terminal fidelity (full-screen TUI rendering, resize), install the native `node-pty` module after unzipping:
```bash
cd "/PATH/TO/VAULT/.obsidian/plugins/${{ env.PLUGIN_ID }}"
curl -fsSLO https://raw.githubusercontent.com/blamouche/obsidian-any-ai-code/${{ github.ref_name }}/package.json
curl -fsSLO https://raw.githubusercontent.com/blamouche/obsidian-any-ai-code/${{ github.ref_name }}/package-lock.json
npm install --omit=dev
```
Then reload the plugin.
### Release assets
- `${{ env.PLUGIN_ID }}-${{ github.ref_name }}.zip` — drop-in plugin folder (the 3 canonical files: `manifest.json`, `main.js`, `styles.css`).
- `manifest.json` / `main.js` / `styles.css` — also attached individually for Obsidian's auto-update protocol and tools like BRAT.
- `versions.json` — Obsidian uses it to find a backwards-compatible plugin version when the current `minAppVersion` is too high for the user's app.
files: |
${{ env.PLUGIN_ID }}-${{ github.ref_name }}.zip
manifest.json
main.js
styles.css
versions.json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}