From 4a4d21cea362fb1d76033a7bedf7cb385c872db3 Mon Sep 17 00:00:00 2001 From: Paul Zgordan <5797437+dancingteeth@users.noreply.github.com> Date: Sun, 25 Oct 2026 16:04:09 +0400 Subject: [PATCH] ci: publish DSH plugin via trusted publishing Adds publish-dsh-plugin.yml, mirroring the OpenCode plugin workflow: a `dsh-plugin-v` tag (or manual dispatch) checks the tag against plugins/dsh-agent-looper/package.json, runs the plugin tests, compiles with the root tsc, and publishes @dancingteeth/dsh-agent-looper over npm OIDC. docs/dsh-plugin.md gains a Publishing section with the one-time npm Trusted Publisher setup. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/publish-dsh-plugin.yml | 53 ++++++++++++++++++++++++ docs/dsh-plugin.md | 11 +++++ 2 files changed, 64 insertions(+) create mode 100644 .github/workflows/publish-dsh-plugin.yml diff --git a/.github/workflows/publish-dsh-plugin.yml b/.github/workflows/publish-dsh-plugin.yml new file mode 100644 index 0000000..f54733d --- /dev/null +++ b/.github/workflows/publish-dsh-plugin.yml @@ -0,0 +1,53 @@ +name: Publish DSH plugin + +# Publishes plugins/dsh-agent-looper (@dancingteeth/dsh-agent-looper). +# Tag `dsh-plugin-v` (matching plugins/dsh-agent-looper/package.json) or run manually. +on: + push: + tags: + - 'dsh-plugin-v*' + workflow_dispatch: + +permissions: + contents: read + id-token: write # required for npm OIDC trusted publishing + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: pnpm/action-setup@v4 + with: + version: 9 + + - uses: actions/setup-node@v4 + with: + node-version: '22.15' + registry-url: 'https://registry.npmjs.org' + cache: pnpm + package-manager-cache: false + + # Trusted publishing needs npm ≥ 11.5.1 (Node 22.14+). + - run: npm install -g npm@^11.5.1 + + - name: Tag matches package version + if: startsWith(github.ref, 'refs/tags/') + run: | + version=$(node -p "require('./plugins/dsh-agent-looper/package.json').version") + test "${GITHUB_REF_NAME}" = "dsh-plugin-v${version}" || { + echo "tag ${GITHUB_REF_NAME} does not match package version ${version}"; exit 1; } + + - run: pnpm install --frozen-lockfile + - run: pnpm test:dsh-plugin:deps + - run: pnpm exec vitest run plugins/dsh-agent-looper + # The plugin has no TypeScript of its own; the root tsc emits plugins/dsh-agent-looper/dist/. + - run: pnpm exec tsc -p plugins/dsh-agent-looper/tsconfig.json + + # OIDC trusted publishing — do not set NODE_AUTH_TOKEN (see publish.yml). + - run: npm publish --access public --ignore-scripts + working-directory: plugins/dsh-agent-looper + env: + NODE_AUTH_TOKEN: '' + NPM_CONFIG_REGISTRY: https://registry.npmjs.org diff --git a/docs/dsh-plugin.md b/docs/dsh-plugin.md index afe817e..9881f60 100644 --- a/docs/dsh-plugin.md +++ b/docs/dsh-plugin.md @@ -72,6 +72,17 @@ Offline (CI — no live `dsh web`): Live (manual): `pnpm exec tsc -p plugins/dsh-agent-looper/tsconfig.json` then `dsh plugin --profile web add ./plugins/dsh-agent-looper`. Freeze loops in the **same** workspace as the product repo. Start `dsh web` from that cwd. Before a `runtime: dsh` grind, set the session to **Full Access** (see runtime doc above). +## Publishing + +[`.github/workflows/publish-dsh-plugin.yml`](../.github/workflows/publish-dsh-plugin.yml) publishes `@dancingteeth/dsh-agent-looper` with npm trusted publishing (OIDC, no token). Bump `plugins/dsh-agent-looper/package.json`, merge to `main`, then push a matching tag: + +```bash +git tag dsh-plugin-v0.1.2 +git push origin dsh-plugin-v0.1.2 +``` + +Or **Actions → Publish DSH plugin → Run workflow**. The tag must match the package version or the job fails. One-time setup: on npm, the package's **Settings → Trusted Publisher** must name GitHub Actions, `dancingteeth` / `agent-looper`, workflow `publish-dsh-plugin.yml` (same steps as [`releasing.md`](./releasing.md)). + ## Related - Cursor marketplace companion: [`docs/cursor-marketplace-plugin.md`](./cursor-marketplace-plugin.md)