-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathrelease.sh
More file actions
executable file
·76 lines (65 loc) · 2.69 KB
/
Copy pathrelease.sh
File metadata and controls
executable file
·76 lines (65 loc) · 2.69 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
#!/usr/bin/env bash
# release.sh — bump version, pack zip, commit, tag, push, create GitHub release.
#
# Usage:
# ./release.sh patch # 0.2.1 → 0.2.2 (bug fix)
# ./release.sh minor # 0.2.1 → 0.3.0 (new feature)
# ./release.sh major # 0.2.1 → 1.0.0 (breaking change)
# ./release.sh 0.2.5 # explicit version
#
# Then upload the resulting zip to:
# https://chrome.google.com/webstore/devconsole
# (manual step — browser-based, can't automate without OAuth setup)
set -euo pipefail
cd "$(dirname "$0")"
if [ $# -lt 1 ]; then
echo "usage: $0 <patch|minor|major|x.y.z>" >&2
exit 64
fi
CUR=$(node -p "require('./manifest.json').version")
case "$1" in
patch) NEW=$(node -e "const [a,b,c]='$CUR'.split('.').map(Number); console.log([a,b,c+1].join('.'))") ;;
minor) NEW=$(node -e "const [a,b]='$CUR'.split('.').map(Number); console.log([a,b+1,0].join('.'))") ;;
major) NEW=$(node -e "const [a]='$CUR'.split('.').map(Number); console.log([a+1,0,0].join('.'))") ;;
*) NEW="$1" ;;
esac
echo "Bumping $CUR → $NEW"
# Update both manifest.json and content.js ECHOLY_VERSION in lock-step
node -e "
const fs = require('fs');
const m = JSON.parse(fs.readFileSync('manifest.json', 'utf8'));
m.version = '$NEW';
fs.writeFileSync('manifest.json', JSON.stringify(m, null, 2) + '\n');
let c = fs.readFileSync('content.js', 'utf8');
c = c.replace(/const ECHOLY_VERSION = \"[^\"]+\";/, 'const ECHOLY_VERSION = \"$NEW\";');
fs.writeFileSync('content.js', c);
"
# Pack the zip
./pack.sh
# Show the diff and ask for confirmation before pushing
echo
git diff --stat manifest.json content.js
echo
read -r -p "Looks right? Commit + tag + push + create GitHub release? [y/N] " ans
[ "$ans" = "y" ] || { echo "aborted; manifest + content.js were updated locally but not committed"; exit 1; }
git add manifest.json content.js
git commit -m "chore: release v$NEW"
git tag -a "v$NEW" -m "v$NEW"
git push
git push --tags
# Optional release notes — paste from CHANGELOG.md or write inline
ZIP="$HOME/echoly-v${NEW}.zip"
gh release create "v$NEW" "$ZIP" \
--title "v$NEW" \
--notes "Install via developer mode: download \`echoly-v${NEW}.zip\`, unzip, drag into chrome://extensions with Developer mode on. Web Store update propagates automatically once Chrome approves."
echo
echo "✓ Released v$NEW"
echo " Zip: $ZIP"
echo " GitHub: https://github.com/sonpiaz/echoly/releases/tag/v$NEW"
echo
echo "Next manual step (Web Store auto-update):"
echo " 1. https://chrome.google.com/webstore/devconsole"
echo " 2. Pick the Echoly item"
echo " 3. Drag $ZIP into the package upload area"
echo " 4. Add a one-line changelog and Submit for review"
echo " 5. Auto-rolls out to users 1-3 days after Chrome approves"