fix(deploy): re-point deploy pipeline + userscript URLs to Forgejo #1

Open
opened 2026-08-06 19:59:33 +03:00 by slaid098 · 0 comments
Owner

Контекст

После бана GitHub-аккаунта slaid098 userscript opencode-voice-dictation сломан в двух местах:

  1. Deploy pipeline (.github/workflows/deploy.yml): использует peaceiris/actions-gh-pages@v4 — стороннюю GitHub Action, которая не скачивается на Forgejo. Run #2 = failure. Ветка dist НЕ существует на Forgejo.
  2. Userscript URLs (vite.config.ts): @updateURL, @downloadURL, @icon, @namespace указывают на raw.githubusercontent.com/slaid098/... (забанен). Существующие юзеры не получают авто-апдейт.

Клон: git clone https://slaid098:2cbcfa4b8f269bed7f1323b418cc7c11637f5cb7@git.slaid098.dev/slaid098/opencode-voice-dictation.git. Default branch: main.

Плагин: vite-plugin-monkey ^5.0.0 — эмитит dist/opencode-voice-dictation.user.js + dist/opencode-voice-dictation.meta.js.

Forgejo raw формат (публичный, 200 без auth): https://git.slaid098.dev/{owner}/{repo}/raw/branch/{branch}/{path}. Подтверждено live.

secrets.GITHUB_TOKEN доступен на Forgejo с contents: write (Gitea-совместимость).

Задача

1. vite.config.ts — 4 URL + version bump

Строка Поле Было Стало
10 namespace https://github.com/slaid098/opencode-voice-dictation https://git.slaid098.dev/slaid098/opencode-voice-dictation
11 version 1.0.5 1.0.6
19 icon https://raw.githubusercontent.com/slaid098/opencode-voice-dictation/main/assets/icon.png https://git.slaid098.dev/slaid098/opencode-voice-dictation/raw/branch/main/assets/icon.png
20-21 updateURL https://raw.githubusercontent.com/.../dist/opencode-voice-dictation.meta.js https://git.slaid098.dev/slaid098/opencode-voice-dictation/raw/branch/dist/opencode-voice-dictation.meta.js
22-23 downloadURL https://raw.githubusercontent.com/.../dist/opencode-voice-dictation.user.js https://git.slaid098.dev/slaid098/opencode-voice-dictation/raw/branch/dist/opencode-voice-dictation.user.js

2. package.json — version bump

Строка 3: "version": "1.0.5""1.0.6" (синхронно с vite.config.ts).

GitHub URL → Forgejo URL (https://git.slaid098.dev/slaid098/opencode-voice-dictation/raw/branch/dist/opencode-voice-dictation.user.js). Добавить note: "Existing users with the legacy GitHub @updateURL need a one-time manual reinstall from the Forgejo URL."

4. .github/workflows/deploy.yml — заменить peaceiris на git push

Заменить шаг "Deploy to dist branch" на:

      - name: Deploy to dist branch
        run: |
          git config user.name  "forgejo-actions[bot]"
          git config user.email "actions@forgejo.slaid098.dev"
          git switch --orphan dist || git checkout --orphan dist
          git rm -rf --cached . >/dev/null 2>&1 || true
          find . -mindepth 1 -maxdepth 1 ! -name dist ! -name .git -exec rm -rf {} +
          cp -a dist/. .
          rm -rf dist
          git add -A
          git commit -m "deploy: ${GITHUB_SHA::7} dist build"
          git push --force "https://slaid098:${GITHUB_TOKEN}@git.slaid098.dev/slaid098/opencode-voice-dictation.git" dist
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Добавить workflow_dispatch: в on: block.

5. Доксы — mirror-agnostic (НЕ хардкодить URL, ссылаться на vite.config.ts)

AGENTS.md (строка 20, "Dist deploy"):

  • peaceiris/actions-gh-pages@v4git push to dist — orphan + force, no third-party action
  • raw files on the dist branchraw files on the dist branch — see vite.config.ts for the exact URLs (source of truth)
  • Добавить: "Existing users with a legacy @updateURL from a previous host need a one-time manual reinstall."

docs/project-map/assets.md (строки 13, 17):

  • Строка 13: путь main/assets/icon.pngForgejo raw-URL (see vite.config.ts @icon)
  • Строка 17: (raw-URL)(Forgejo raw-URL, see vite.config.ts)

Контракты

  • vite.config.ts — единственное место с полным canonical URL (source of truth). Доксы ссылаются на него, не дублируют URL (mirror-agnostic — репо будет зеркалироваться).
  • Version bump синхронный: vite.config.ts + package.json = 1.0.6.
  • deploy.yml не использует сторонних actions (только actions/checkout, actions/setup-node, run:).
  • dist branch создаётся автоматически (orphan + force push).
  • Forgejo raw URL формат: /raw/branch/{branch}/{path}.

Инварианты

  • npm run builddist/opencode-voice-dictation.user.js + dist/opencode-voice-dictation.meta.js (имена не меняются).
  • @version в собранном .user.js = 1.0.6.
  • CI (ci.yml) зелёный: lint, typecheck, knip, test.
  • Deploy (deploy.yml) после merge → success, dist создан, оба файла доступны по Forgejo raw URL (public, 200).

Граничные случаи

  • Первый run: dist не существует → --orphan + --force. Последующие: --force перезаписывает (wipe + replace).
  • actions/checkout@v7 persist-credentials: используем явный URL с ${GITHUB_TOKEN} для надёжности.
  • Существующие юзеры со старым GitHub @updateURL: one-time manual reinstall (auto-update не дойдёт).
  • @namespace — не fetchable URL (uniqueness key), но репоинт для консистентности.

Влияние на связанные компоненты

  • deploy.yml: peaceirisgit push. dist branch появляется на Forgejo.
  • vite.config.ts: 4 URL + version. vite-plugin-monkey инжектит их в ==UserScript== header.
  • README.md: install links → Forgejo.
  • AGENTS.md/docs/project-map/assets.md: mirror-agnostic (ссылка на vite.config.ts).
  • ADR-0005, handoff docs: НЕ трогаем (исторические).

Вне scope

  • Обновление docs/decisions/ и docs/handoff/ (исторические ADR).
  • Зеркалирование на GitLab/Codeberg.
  • Изменение ci.yml.
  • Удаление .github/dependabot.yml.

Критерии приемки

  • vite.config.ts: 4 URL → git.slaid098.dev/.../raw/branch/..., version: "1.0.6".
  • package.json: "version": "1.0.6".
  • README.md (EN+RU): install links → Forgejo, note про one-time reinstall.
  • deploy.yml: peaceiris удалён, git push --force (orphan), workflow_dispatch: добавлен.
  • AGENTS.md "Dist deploy": peaceiris убран, ссылка на vite.config.ts как source of truth.
  • docs/project-map/assets.md: строки 13, 17 ссылаются на vite.config.ts.
  • CI (ci.yml) зелёный.
  • Deploy (deploy.yml) success после merge: dist создан, curl -o /dev/null -w "%{http_code}" ".../raw/branch/dist/opencode-voice-dictation.user.js"200.
## Контекст После бана GitHub-аккаунта `slaid098` userscript `opencode-voice-dictation` сломан в двух местах: 1. **Deploy pipeline** (`.github/workflows/deploy.yml`): использует `peaceiris/actions-gh-pages@v4` — стороннюю GitHub Action, которая не скачивается на Forgejo. Run #2 = failure. Ветка `dist` НЕ существует на Forgejo. 2. **Userscript URLs** (`vite.config.ts`): `@updateURL`, `@downloadURL`, `@icon`, `@namespace` указывают на `raw.githubusercontent.com/slaid098/...` (забанен). Существующие юзеры не получают авто-апдейт. Клон: `git clone https://slaid098:2cbcfa4b8f269bed7f1323b418cc7c11637f5cb7@git.slaid098.dev/slaid098/opencode-voice-dictation.git`. Default branch: `main`. Плагин: `vite-plugin-monkey` ^5.0.0 — эмитит `dist/opencode-voice-dictation.user.js` + `dist/opencode-voice-dictation.meta.js`. Forgejo raw формат (публичный, 200 без auth): `https://git.slaid098.dev/{owner}/{repo}/raw/branch/{branch}/{path}`. Подтверждено live. `secrets.GITHUB_TOKEN` доступен на Forgejo с `contents: write` (Gitea-совместимость). ## Задача ### 1. `vite.config.ts` — 4 URL + version bump | Строка | Поле | Было | Стало | |---|---|---|---| | 10 | `namespace` | `https://github.com/slaid098/opencode-voice-dictation` | `https://git.slaid098.dev/slaid098/opencode-voice-dictation` | | 11 | `version` | `1.0.5` | `1.0.6` | | 19 | `icon` | `https://raw.githubusercontent.com/slaid098/opencode-voice-dictation/main/assets/icon.png` | `https://git.slaid098.dev/slaid098/opencode-voice-dictation/raw/branch/main/assets/icon.png` | | 20-21 | `updateURL` | `https://raw.githubusercontent.com/.../dist/opencode-voice-dictation.meta.js` | `https://git.slaid098.dev/slaid098/opencode-voice-dictation/raw/branch/dist/opencode-voice-dictation.meta.js` | | 22-23 | `downloadURL` | `https://raw.githubusercontent.com/.../dist/opencode-voice-dictation.user.js` | `https://git.slaid098.dev/slaid098/opencode-voice-dictation/raw/branch/dist/opencode-voice-dictation.user.js` | ### 2. `package.json` — version bump Строка 3: `"version": "1.0.5"` → `"1.0.6"` (синхронно с `vite.config.ts`). ### 3. `README.md` — 2 install link (строки 43 EN, 107 RU) GitHub URL → Forgejo URL (`https://git.slaid098.dev/slaid098/opencode-voice-dictation/raw/branch/dist/opencode-voice-dictation.user.js`). Добавить note: "Existing users with the legacy GitHub `@updateURL` need a one-time manual reinstall from the Forgejo URL." ### 4. `.github/workflows/deploy.yml` — заменить peaceiris на git push Заменить шаг "Deploy to dist branch" на: ```yaml - name: Deploy to dist branch run: | git config user.name "forgejo-actions[bot]" git config user.email "actions@forgejo.slaid098.dev" git switch --orphan dist || git checkout --orphan dist git rm -rf --cached . >/dev/null 2>&1 || true find . -mindepth 1 -maxdepth 1 ! -name dist ! -name .git -exec rm -rf {} + cp -a dist/. . rm -rf dist git add -A git commit -m "deploy: ${GITHUB_SHA::7} dist build" git push --force "https://slaid098:${GITHUB_TOKEN}@git.slaid098.dev/slaid098/opencode-voice-dictation.git" dist env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} ``` Добавить `workflow_dispatch:` в `on:` block. ### 5. Доксы — mirror-agnostic (НЕ хардкодить URL, ссылаться на vite.config.ts) **AGENTS.md** (строка 20, "Dist deploy"): - `peaceiris/actions-gh-pages@v4` → `git push to dist — orphan + force, no third-party action` - `raw files on the dist branch` → `raw files on the dist branch — see vite.config.ts for the exact URLs (source of truth)` - Добавить: "Existing users with a legacy `@updateURL` from a previous host need a one-time manual reinstall." **docs/project-map/assets.md** (строки 13, 17): - Строка 13: `путь main/assets/icon.png` → `Forgejo raw-URL (see vite.config.ts @icon)` - Строка 17: `(raw-URL)` → `(Forgejo raw-URL, see vite.config.ts)` ## Контракты - `vite.config.ts` — единственное место с полным canonical URL (source of truth). Доксы ссылаются на него, не дублируют URL (mirror-agnostic — репо будет зеркалироваться). - Version bump синхронный: `vite.config.ts` + `package.json` = `1.0.6`. - `deploy.yml` не использует сторонних actions (только `actions/checkout`, `actions/setup-node`, `run:`). - `dist` branch создаётся автоматически (orphan + force push). - Forgejo raw URL формат: `/raw/branch/{branch}/{path}`. ## Инварианты - `npm run build` → `dist/opencode-voice-dictation.user.js` + `dist/opencode-voice-dictation.meta.js` (имена не меняются). - `@version` в собранном `.user.js` = `1.0.6`. - CI (`ci.yml`) зелёный: lint, typecheck, knip, test. - Deploy (`deploy.yml`) после merge → success, `dist` создан, оба файла доступны по Forgejo raw URL (public, 200). ## Граничные случаи - Первый run: `dist` не существует → `--orphan` + `--force`. Последующие: `--force` перезаписывает (wipe + replace). - `actions/checkout@v7` persist-credentials: используем явный URL с `${GITHUB_TOKEN}` для надёжности. - Существующие юзеры со старым GitHub `@updateURL`: one-time manual reinstall (auto-update не дойдёт). - `@namespace` — не fetchable URL (uniqueness key), но репоинт для консистентности. ## Влияние на связанные компоненты - `deploy.yml`: `peaceiris` → `git push`. `dist` branch появляется на Forgejo. - `vite.config.ts`: 4 URL + version. `vite-plugin-monkey` инжектит их в `==UserScript==` header. - `README.md`: install links → Forgejo. - `AGENTS.md`/`docs/project-map/assets.md`: mirror-agnostic (ссылка на `vite.config.ts`). - ADR-0005, handoff docs: НЕ трогаем (исторические). ## Вне scope - Обновление `docs/decisions/` и `docs/handoff/` (исторические ADR). - Зеркалирование на GitLab/Codeberg. - Изменение `ci.yml`. - Удаление `.github/dependabot.yml`. ## Критерии приемки - [ ] `vite.config.ts`: 4 URL → `git.slaid098.dev/.../raw/branch/...`, `version: "1.0.6"`. - [ ] `package.json`: `"version": "1.0.6"`. - [ ] `README.md` (EN+RU): install links → Forgejo, note про one-time reinstall. - [ ] `deploy.yml`: `peaceiris` удалён, `git push --force` (orphan), `workflow_dispatch:` добавлен. - [ ] `AGENTS.md` "Dist deploy": `peaceiris` убран, ссылка на `vite.config.ts` как source of truth. - [ ] `docs/project-map/assets.md`: строки 13, 17 ссылаются на `vite.config.ts`. - [ ] CI (`ci.yml`) зелёный. - [ ] Deploy (`deploy.yml`) success после merge: `dist` создан, `curl -o /dev/null -w "%{http_code}" ".../raw/branch/dist/opencode-voice-dictation.user.js"` → `200`.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: slaid098/opencode-voice-dictation#1
No description provided.