-
Notifications
You must be signed in to change notification settings - Fork 0
107 lines (89 loc) · 3.07 KB
/
release.yml
File metadata and controls
107 lines (89 loc) · 3.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: Release
on:
push:
tags:
- 'browser-agent-driver-v*'
permissions:
contents: write
jobs:
release:
if: github.repository == 'tangle-network/browser-agent-driver'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '22'
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build
run: pnpm build
- name: Extract version
id: version
run: |
VERSION="${GITHUB_REF_NAME#browser-agent-driver-v}"
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
echo "Version: ${VERSION}"
- name: Package standalone tarball
run: |
VERSION="${{ steps.version.outputs.version }}"
STAGING="bad-v${VERSION}"
mkdir -p "${STAGING}"
# Copy dist, package.json, postinstall script, and required runtime files
cp -r dist "${STAGING}/"
cp package.json "${STAGING}/"
cp README.md LICENSE "${STAGING}/" 2>/dev/null || true
mkdir -p "${STAGING}/scripts"
cp scripts/postinstall-provider-patches.mjs "${STAGING}/scripts/"
# Install production dependencies only
cd "${STAGING}"
pnpm install --prod --no-lockfile --ignore-scripts
node scripts/postinstall-provider-patches.mjs
cd ..
# Create launcher script
cat > "${STAGING}/bad" << 'LAUNCHER'
#!/usr/bin/env bash
set -euo pipefail
DIR="$(cd "$(dirname "$0")" && pwd)"
exec node "${DIR}/dist/cli.js" "$@"
LAUNCHER
chmod +x "${STAGING}/bad"
# Tar it up
tar czf "bad-v${VERSION}-node.tar.gz" "${STAGING}"
sha256sum "bad-v${VERSION}-node.tar.gz" > "bad-v${VERSION}-node.tar.gz.sha256"
- name: Generate release notes
run: |
VERSION="${{ steps.version.outputs.version }}"
cat > release-notes.md << 'NOTES'
## Install
### One-liner (recommended)
```bash
curl -fsSL https://raw.githubusercontent.com/tangle-network/browser-agent-driver/main/scripts/install.sh | sh
```
### npm
```bash
npm i -g @tangle-network/browser-agent-driver
npx playwright install chromium
```
### Uninstall
```bash
curl -fsSL https://raw.githubusercontent.com/tangle-network/browser-agent-driver/main/scripts/uninstall.sh | sh
```
NOTES
- name: Create GitHub release
env:
GH_TOKEN: ${{ github.token }}
run: |
VERSION="${{ steps.version.outputs.version }}"
gh release create "${GITHUB_REF_NAME}" \
--title "v${VERSION}" \
--notes-file release-notes.md \
"bad-v${VERSION}-node.tar.gz" \
"bad-v${VERSION}-node.tar.gz.sha256"