diff --git a/.github/workflows/release-dsh-plugin.yml b/.github/workflows/release-dsh-plugin.yml new file mode 100644 index 0000000..69ae0bd --- /dev/null +++ b/.github/workflows/release-dsh-plugin.yml @@ -0,0 +1,105 @@ +name: Release dsh plugin + +on: + push: + tags: + - dsh-plugin-v* + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: release-dsh-plugin-${{ github.ref }} + cancel-in-progress: false + +env: + PACKAGE_NAME: "@wxg-prc-cpg/browser-skill-dsh-plugin" + PACKAGE_DIR: packages/dsh-plugin-browserskill + +jobs: + resolve: + runs-on: ubuntu-latest + outputs: + version: ${{ steps.version.outputs.version }} + tag: ${{ steps.version.outputs.tag }} + steps: + - uses: actions/checkout@v6 + + - name: Resolve plugin version + id: version + shell: bash + run: | + set -euo pipefail + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then + VERSION="$(node -p "require('./${{ env.PACKAGE_DIR }}/package.json').version")" + else + VERSION="${GITHUB_REF_NAME#dsh-plugin-v}" + fi + VERSION="${VERSION#v}" + echo "version=${VERSION}" >> "$GITHUB_OUTPUT" + echo "tag=dsh-plugin-v${VERSION}" >> "$GITHUB_OUTPUT" + + guard: + needs: resolve + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + + - name: Verify tag matches package.json name and version + shell: bash + run: | + set -euo pipefail + PKG_NAME="$(node -p "require('./${{ env.PACKAGE_DIR }}/package.json').name")" + PKG_VERSION="$(node -p "require('./${{ env.PACKAGE_DIR }}/package.json').version")" + RELEASE_VERSION="${{ needs.resolve.outputs.version }}" + if [ "$PKG_NAME" != "$PACKAGE_NAME" ]; then + echo "package.json name (${PKG_NAME}) does not match expected ${PACKAGE_NAME}" + exit 1 + fi + if [ "$PKG_VERSION" != "$RELEASE_VERSION" ]; then + echo "${PACKAGE_DIR}/package.json version (${PKG_VERSION}) does not match release version (${RELEASE_VERSION})" + exit 1 + fi + echo "Version guard passed: ${PKG_NAME}@${RELEASE_VERSION}" + + publish: + needs: [resolve, guard] + runs-on: ubuntu-latest + # Secret NPM_TOKEN is stored on the GitHub Environment also named NPM_TOKEN. + environment: NPM_TOKEN + permissions: + contents: read + steps: + - uses: actions/checkout@v6 + + - uses: pnpm/action-setup@v6 + + - uses: actions/setup-node@v6 + with: + node-version: 22 + cache: pnpm + registry-url: https://registry.npmjs.org + scope: "@wxg-prc-cpg" + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Typecheck plugin + run: pnpm --filter "${{ env.PACKAGE_NAME }}" typecheck + + - name: Test plugin + run: pnpm --filter "${{ env.PACKAGE_NAME }}" test + + - name: Publish to npm + working-directory: ${{ env.PACKAGE_DIR }} + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + run: | + set -euo pipefail + if [ -z "${NODE_AUTH_TOKEN:-}" ]; then + echo "::error::Environment secret NPM_TOKEN is not configured" + exit 1 + fi + pnpm publish --access public --no-git-checks + echo "Published ${PACKAGE_NAME}@${{ needs.resolve.outputs.version }}" diff --git a/package.json b/package.json index f4b4313..214c278 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "ext:dev": "pnpm --filter @browser-skill/extension dev", "ext:test": "pnpm --filter @browser-skill/extension test", "vom:test": "pnpm --filter @browser-skill/vom test", - "lint": "biome check . && stylelint \"**/*.css\" && pnpm --filter dsh-plugin-browserskill typecheck && pnpm --filter dsh-plugin-browserskill test", + "lint": "biome check . && stylelint \"**/*.css\" && pnpm --filter @wxg-prc-cpg/browser-skill-dsh-plugin typecheck && pnpm --filter @wxg-prc-cpg/browser-skill-dsh-plugin test", "format": "biome format --write ." }, "devDependencies": { diff --git a/packages/dsh-plugin-browserskill/README.md b/packages/dsh-plugin-browserskill/README.md index 5123b11..592bdad 100644 --- a/packages/dsh-plugin-browserskill/README.md +++ b/packages/dsh-plugin-browserskill/README.md @@ -1,5 +1,7 @@ # dsh-plugin-browserskill +npm: [`@wxg-prc-cpg/browser-skill-dsh-plugin`](https://www.npmjs.com/package/@wxg-prc-cpg/browser-skill-dsh-plugin) + A [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (dsh) tool plugin that exposes [BrowserSkill](https://github.com/Tencent/BrowserSkill) (`bsk`) browser automation to the model. @@ -58,7 +60,7 @@ a session owned by another program. The plugin follows the standard dsh bundle layout (`dsh.bundle` manifest + `cordis.patch.yml`): ```sh -dsh plugin --profile add +dsh plugin --profile add @wxg-prc-cpg/browser-skill-dsh-plugin dsh --profile ``` @@ -166,11 +168,27 @@ shell's theme cannot bleed back in. ```sh pnpm install -pnpm --filter dsh-plugin-browserskill typecheck -pnpm --filter dsh-plugin-browserskill test # unit tests mock bsk; no browser needed -pnpm --filter dsh-plugin-browserskill build # tsdown -> lib/ +pnpm --filter @wxg-prc-cpg/browser-skill-dsh-plugin typecheck +pnpm --filter @wxg-prc-cpg/browser-skill-dsh-plugin test # unit tests mock bsk; no browser needed +pnpm --filter @wxg-prc-cpg/browser-skill-dsh-plugin build # tsdown -> lib/ ``` +## Publishing + +The GitHub Actions workflow **Release dsh plugin** publishes this package to npm +as `@wxg-prc-cpg/browser-skill-dsh-plugin`. The Cordis plugin id stays +`dsh-plugin-browserskill`. + +Trigger it by pushing a tag that matches `package.json`'s `version`: + +```sh +git tag dsh-plugin-v0.1.0 +git push origin dsh-plugin-v0.1.0 +``` + +Or run the workflow from the Actions tab (`workflow_dispatch`). The job reads +`NPM_TOKEN` from the GitHub Environment of the same name. + ## License MIT diff --git a/packages/dsh-plugin-browserskill/package.json b/packages/dsh-plugin-browserskill/package.json index 4b1ce5e..8fd52b5 100644 --- a/packages/dsh-plugin-browserskill/package.json +++ b/packages/dsh-plugin-browserskill/package.json @@ -1,7 +1,27 @@ { - "name": "dsh-plugin-browserskill", + "name": "@wxg-prc-cpg/browser-skill-dsh-plugin", "description": "DeepSeek Harness tool plugin that exposes BrowserSkill (bsk) browser automation to the model", "version": "0.1.0", + "license": "MIT", + "publishConfig": { + "access": "public", + "registry": "https://registry.npmjs.org/" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Tencent/BrowserSkill.git", + "directory": "packages/dsh-plugin-browserskill" + }, + "homepage": "https://github.com/Tencent/BrowserSkill/tree/main/packages/dsh-plugin-browserskill#readme", + "bugs": { + "url": "https://github.com/Tencent/BrowserSkill/issues" + }, + "keywords": [ + "dsh-plugin", + "deepseek-harness", + "browserskill", + "browser-automation" + ], "type": "module", "main": "lib/index.mjs", "types": "lib/index.d.mts", @@ -106,6 +126,5 @@ "vitest": "^4.1.6", "@browser-skill/ui": "workspace:*", "@remixicon/react": "^4.9.0" - }, - "license": "MIT" + } }