-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathupdate_version.sh
More file actions
executable file
·67 lines (56 loc) · 1.67 KB
/
update_version.sh
File metadata and controls
executable file
·67 lines (56 loc) · 1.67 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
#!/usr/bin/env bash
set -euo pipefail
# Usage: ./update_version.sh <old_version> <new_version>
# Example: ./update_version.sh 3.2.2 4.0.0
OLD_VERSION="$1"
NEW_VERSION="$2"
echo "Updating Testify version: $OLD_VERSION → $NEW_VERSION"
echo ""
# 1. Update plugin version and dependency references
echo "Updating Markdown files..."
find . -type f -name "*.md" ! -path "*/docs/node_modules/*" | while read -r file; do
updated=false
# Update plugin block: id("dev.testify") version "x.y.z"
if grep -q 'id("dev.testify")' "$file"; then
sed -i.bak -E \
"s/(id\\(\"dev\\.testify\"\\) version \")${OLD_VERSION}(\" apply false)/\\1${NEW_VERSION}\\2/g" \
"$file"
updated=true
fi
# Update dependency lines: androidTestImplementation "dev.testify:<artifact>:x.y.z"
if grep -q 'dev.testify:' "$file"; then
sed -i.bak -E \
"s/(dev\\.testify:[^\":]+:)${OLD_VERSION}/\\1${NEW_VERSION}/g" \
"$file"
updated=true
fi
if [ "$updated" = true ]; then
rm -f "${file}.bak"
echo " Updated $file"
else
rm -f "${file}.bak" 2>/dev/null || true
fi
done
# 2. Update CHANGELOG.md files
echo ""
echo "Updating CHANGELOG entries..."
find . -type f -name "CHANGELOG.md" ! -path "*/docs/node_modules/*" | while read -r changelog; do
if ! grep -q "## ${NEW_VERSION}" "$changelog"; then
tmpfile=$(mktemp)
{
echo "## ${NEW_VERSION}"
echo ""
echo "- TODO: Add changes here"
echo ""
echo "---"
echo ""
cat "$changelog"
} > "$tmpfile"
mv "$tmpfile" "$changelog"
echo " Added entry to $changelog"
else
echo " Skipped $changelog (entry already exists)"
fi
done
echo ""
echo "✅ All done!"