Skip to content

Commit 9853945

Browse files
committed
feat: fix npm trusted publishing, add GitHub release workflow
- publish-npm.yml: add registry-url to setup-node, set NODE_AUTH_TOKEN from NPM_TOKEN secret, add Playwright install for test step - release.yml: new workflow creates GitHub releases with standalone tarball (bad-vX.Y.Z-node.tar.gz) + sha256 checksum on tag push - README: add standalone curl install method alongside npm
1 parent 9f82d84 commit 9853945

3 files changed

Lines changed: 126 additions & 3 deletions

File tree

.github/workflows/publish-npm.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ jobs:
2323
publish:
2424
if: github.repository == 'tangle-network/browser-agent-driver'
2525
runs-on: ubuntu-latest
26-
env:
27-
NODE_AUTH_TOKEN: ''
2826
steps:
2927
- name: Checkout
3028
uses: actions/checkout@v4
@@ -39,13 +37,17 @@ jobs:
3937
with:
4038
node-version: '22'
4139
cache: pnpm
40+
registry-url: 'https://registry.npmjs.org'
4241

4342
- name: Install dependencies
4443
run: pnpm install --frozen-lockfile
4544

4645
- name: Build
4746
run: pnpm build
4847

48+
- name: Install Playwright browsers
49+
run: pnpm exec playwright install --with-deps chromium
50+
4951
- name: Test
5052
run: pnpm test
5153

@@ -81,3 +83,5 @@ jobs:
8183
8284
- name: Publish to npm
8385
run: npm publish --provenance --access public
86+
env:
87+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/release.yml

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'browser-agent-driver-v*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
release:
13+
if: github.repository == 'tangle-network/browser-agent-driver'
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Setup pnpm
20+
uses: pnpm/action-setup@v4
21+
with:
22+
version: 10
23+
24+
- name: Setup Node
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: '22'
28+
cache: pnpm
29+
30+
- name: Install dependencies
31+
run: pnpm install --frozen-lockfile
32+
33+
- name: Build
34+
run: pnpm build
35+
36+
- name: Extract version
37+
id: version
38+
run: |
39+
VERSION="${GITHUB_REF_NAME#browser-agent-driver-v}"
40+
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
41+
echo "Version: ${VERSION}"
42+
43+
- name: Package standalone tarball
44+
run: |
45+
VERSION="${{ steps.version.outputs.version }}"
46+
STAGING="bad-v${VERSION}"
47+
mkdir -p "${STAGING}"
48+
49+
# Copy dist, package.json, and required runtime files
50+
cp -r dist "${STAGING}/"
51+
cp package.json "${STAGING}/"
52+
cp README.md LICENSE "${STAGING}/" 2>/dev/null || true
53+
54+
# Install production dependencies only
55+
cd "${STAGING}"
56+
pnpm install --prod --no-lockfile
57+
cd ..
58+
59+
# Create launcher script
60+
cat > "${STAGING}/bad" << 'LAUNCHER'
61+
#!/usr/bin/env bash
62+
set -euo pipefail
63+
DIR="$(cd "$(dirname "$0")" && pwd)"
64+
exec node "${DIR}/dist/cli.js" "$@"
65+
LAUNCHER
66+
chmod +x "${STAGING}/bad"
67+
68+
# Tar it up
69+
tar czf "bad-v${VERSION}-node.tar.gz" "${STAGING}"
70+
sha256sum "bad-v${VERSION}-node.tar.gz" > "bad-v${VERSION}-node.tar.gz.sha256"
71+
72+
- name: Generate release notes
73+
id: notes
74+
run: |
75+
VERSION="${{ steps.version.outputs.version }}"
76+
cat > release-notes.md << EOF
77+
## Install
78+
79+
### npm (recommended)
80+
\`\`\`bash
81+
npm i -g @tangle-network/browser-agent-driver
82+
npx playwright install chromium
83+
\`\`\`
84+
85+
### Standalone (requires Node.js 20+)
86+
\`\`\`bash
87+
curl -fsSL https://github.com/tangle-network/browser-agent-driver/releases/download/browser-agent-driver-v${VERSION}/bad-v${VERSION}-node.tar.gz | tar xz
88+
export PATH="\$PWD/bad-v${VERSION}:\$PATH"
89+
npx playwright install chromium
90+
bad run --goal "..." --url https://...
91+
\`\`\`
92+
93+
### Verify checksum
94+
\`\`\`bash
95+
curl -fsSL https://github.com/tangle-network/browser-agent-driver/releases/download/browser-agent-driver-v${VERSION}/bad-v${VERSION}-node.tar.gz.sha256 | sha256sum -c
96+
\`\`\`
97+
98+
---
99+
100+
See [CHANGELOG](https://github.com/tangle-network/browser-agent-driver/blob/main/CHANGELOG.md) for details.
101+
EOF
102+
103+
- name: Create GitHub release
104+
env:
105+
GH_TOKEN: ${{ github.token }}
106+
run: |
107+
VERSION="${{ steps.version.outputs.version }}"
108+
gh release create "${GITHUB_REF_NAME}" \
109+
--title "v${VERSION}" \
110+
--notes-file release-notes.md \
111+
"bad-v${VERSION}-node.tar.gz" \
112+
"bad-v${VERSION}-node.tar.gz.sha256"

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,24 @@ LLM-driven browser automation. Reads page state via accessibility tree, decides
1111
```bash
1212
# global install — gives you the `bad` command
1313
npm i -g @tangle-network/browser-agent-driver
14+
npx playwright install chromium
1415

1516
# or run without installing
1617
npx @tangle-network/browser-agent-driver run --goal "..." --url https://...
1718
```
1819

19-
Requires Playwright's Chromium. Install it after:
20+
### Standalone (no npm)
2021

2122
```bash
23+
# download, extract, add to PATH
24+
curl -fsSL https://github.com/tangle-network/browser-agent-driver/releases/latest/download/bad-v0.7.0-node.tar.gz | tar xz
25+
export PATH="$PWD/bad-v0.7.0:$PATH"
2226
npx playwright install chromium
27+
bad run --goal "..." --url https://...
2328
```
2429

30+
Requires Node.js 20+. See [Releases](https://github.com/tangle-network/browser-agent-driver/releases) for all versions.
31+
2532
### As a library
2633

2734
```bash

0 commit comments

Comments
 (0)