diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 631f15e..b52d866 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,8 +17,7 @@ jobs: node-version: "22" cache: "npm" - - name: Install - run: npm ci + - run: npm ci - name: Lint (Biome) run: npm run lint @@ -31,13 +30,3 @@ jobs: - name: Test (Vitest + Coverage) run: npm run test - - - name: Build (Vite → .user.js) - run: npm run build - - - name: Upload artifact - uses: actions/upload-artifact@v4 - if: github.event_name == 'push' - with: - name: opencode-voice-dictation-user-js - path: dist/*.user.js diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..0946d93 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,54 @@ +name: Release + +on: + push: + branches: [main] + tags: ["v*"] + +permissions: + contents: write + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: "22" + cache: "npm" + + - run: npm ci + + - name: Lint + run: npm run lint + + - name: Typecheck + run: npm run typecheck + + - name: Knip + run: npm run knip + + - name: Test + run: npm run test + + - name: Build + run: npm run build + + - name: Deploy to dist branch + uses: peaceiris/actions-gh-pages@v4 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./dist + publish_branch: dist + keep_files: false + + - name: Create GitHub Release on tag + if: startsWith(github.ref, 'refs/tags/v') + uses: softprops/action-gh-release@v2 + with: + files: | + dist/opencode-voice-dictation.user.js + dist/opencode-voice-dictation.meta.js + generate_release_notes: true diff --git a/README.md b/README.md index 0a30f4a..f448224 100644 --- a/README.md +++ b/README.md @@ -45,18 +45,30 @@ Voice dictation for [OpenCode](https://opencode.ai) web interface using OpenAI W ### Install +> **One-click install**: Open this link in your browser with Violentmonkey/Tampermonkey installed: +> +> **[Install Script](https://raw.githubusercontent.com/slaid098/opencode-voice-dictation/dist/opencode-voice-dictation.user.js)** +> +> Your userscript manager will intercept the download and show an installation dialog. + #### Desktop (Vivaldi + Violentmonkey) 1. Install [Violentmonkey](https://violentmonkey.github.io/) extension in Vivaldi -2. Open Violentmonkey dashboard → **+** → **Create new script** -3. Paste the contents of `dist/opencode-voice-dictation.user.js` -4. Save (Ctrl+S) +2. Click the [Install Script](https://raw.githubusercontent.com/slaid098/opencode-voice-dictation/dist/opencode-voice-dictation.user.js) link +3. Confirm installation in the Violentmonkey dialog #### Android (Firefox + Tampermonkey) 1. Install [Firefox for Android](https://play.google.com/store/apps/details?id=org.mozilla.firefox) from Play Store 2. Install [Tampermonkey](https://addons.mozilla.org/en-US/android/addon/tampermonkey/) from Firefox Add-ons -3. Open Tampermonkey dashboard → **+** → paste the script → Save +3. In Firefox, open the [Install Script](https://raw.githubusercontent.com/slaid098/opencode-voice-dictation/dist/opencode-voice-dictation.user.js) link +4. Confirm installation in the Tampermonkey dialog + +#### Manual install (from GitHub Releases) + +1. Go to [Releases](https://github.com/slaid098/opencode-voice-dictation/releases) +2. Download `opencode-voice-dictation.user.js` from the latest release +3. Open Violentmonkey/Tampermonkey dashboard → **+** → paste the file contents → Save ### Setup @@ -65,6 +77,15 @@ Voice dictation for [OpenCode](https://opencode.ai) web interface using OpenAI W 3. Open Violentmonkey/Tampermonkey menu → **"Set Groq API Key"** 4. Paste your key (`gsk_...`) +### Auto-Update + +The script updates automatically. No action needed. + +- `@updateURL` checks for new versions periodically (every 24h in Tampermonkey, every 7 days in Violentmonkey) +- Only a tiny `.meta.js` (~1KB) is downloaded to check the version +- If a new version is found, the full `.user.js` (~18KB) is downloaded and installed +- Updates are published automatically by CI when code is pushed to `main` + ### Usage 1. Open OpenCode web in your browser @@ -123,18 +144,30 @@ All settings available via the Violentmonkey/Tampermonkey menu: ### Установка +> **Установка в один клик**: Откройте эту ссылку в браузере с установленным Violentmonkey/Tampermonkey: +> +> **[Установить скрипт](https://raw.githubusercontent.com/slaid098/opencode-voice-dictation/dist/opencode-voice-dictation.user.js)** +> +> Менеджер скриптов перехватит загрузку и покажет диалог установки. + #### ПК (Vivaldi + Violentmonkey) 1. Установите расширение [Violentmonkey](https://violentmonkey.github.io/) в Vivaldi -2. Откройте панель Violentmonkey → **+** → **Создать новый скрипт** -3. Вставьте содержимое `dist/opencode-voice-dictation.user.js` -4. Сохраните (Ctrl+S) +2. Нажмите на ссылку [Установить скрипт](https://raw.githubusercontent.com/slaid098/opencode-voice-dictation/dist/opencode-voice-dictation.user.js) +3. Подтвердите установку в диалоге Violentmonkey #### Android (Firefox + Tampermonkey) 1. Установите [Firefox для Android](https://play.google.com/store/apps/details?id=org.mozilla.firefox) из Play Store 2. Установите [Tampermonkey](https://addons.mozilla.org/ru/android/addon/tampermonkey/) из дополнений Firefox -3. Откройте панель Tampermonkey → **+** → вставьте скрипт → Сохранить +3. В Firefox откройте ссылку [Установить скрипт](https://raw.githubusercontent.com/slaid098/opencode-voice-dictation/dist/opencode-voice-dictation.user.js) +4. Подтвердите установку в диалоге Tampermonkey + +#### Ручная установка (из GitHub Releases) + +1. Перейдите на страницу [Releases](https://github.com/slaid098/opencode-voice-dictation/releases) +2. Скачайте `opencode-voice-dictation.user.js` из последнего релиза +3. Откройте панель Violentmonkey/Tampermonkey → **+** → вставьте содержимое файла → Сохранить ### Настройка @@ -143,6 +176,15 @@ All settings available via the Violentmonkey/Tampermonkey menu: 3. Откройте меню Violentmonkey/Tampermonkey → **"Set Groq API Key"** 4. Вставьте ваш ключ (`gsk_...`) +### Автообновление + +Скрипт обновляется автоматически. Ничего делать не нужно. + +- `@updateURL` периодически проверяет новые версии (каждые 24ч в Tampermonkey, каждые 7 дней в Violentmonkey) +- Скачивается только маленький `.meta.js` (~1KB) для проверки версии +- Если найдена новая версия — скачивается полный `.user.js` (~18KB) и устанавливается +- Обновления публикуются автоматически CI при пуше в `main` + ### Использование 1. Откройте OpenCode web в браузере diff --git a/vite.config.ts b/vite.config.ts index 2d3c7cf..06d9366 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -18,9 +18,9 @@ export default defineConfig({ "run-at": "document-idle", icon: "https://raw.githubusercontent.com/slaid098/opencode-voice-dictation/main/assets/icon.png", updateURL: - "https://raw.githubusercontent.com/slaid098/opencode-voice-dictation/main/dist/opencode-voice-dictation.user.js", + "https://raw.githubusercontent.com/slaid098/opencode-voice-dictation/dist/opencode-voice-dictation.meta.js", downloadURL: - "https://raw.githubusercontent.com/slaid098/opencode-voice-dictation/main/dist/opencode-voice-dictation.user.js", + "https://raw.githubusercontent.com/slaid098/opencode-voice-dictation/dist/opencode-voice-dictation.user.js", }, build: { fileName: "opencode-voice-dictation.user.js",