Skip to content

Commit e0e3bc3

Browse files
committed
Automate upgrade procedure with shell script
1 parent 782fdf7 commit e0e3bc3

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

upgrade.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/env bash
2+
3+
function version_of() {
4+
echo "$(awk "match(\$0, \"\\\"$1\\\": \\\"(.+)\\\"\", m) {print m[1]}" package.json)"
5+
}
6+
7+
LIB_CURRENT="$(version_of 'version')"
8+
LIB_NEXT="$1"
9+
if [[ -z "$LIB_NEXT" ]]; then
10+
echo "Missing version argument"
11+
exit 1
12+
fi
13+
14+
BICON_CURRENT="$(version_of 'bootstrap-icons')"
15+
16+
echo "Upgrading from v$LIB_CURRENT to v$LIB_NEXT..."
17+
18+
yarn upgrade || { echo '`yarn upgrade` failed'; exit 1; }
19+
yarn build || { echo '`yarn build` failed'; exit 1;}
20+
21+
pushd dev-vite
22+
yarn upgrade || { echo '`yarn upgrade` failed'; exit 1; }
23+
popd
24+
25+
BICON_NEXT="$(version_of 'bootstrap-icons')"
26+
27+
sed -i "s/$LIB_CURRENT/$LIB_NEXT/g" package.json README.md
28+
29+
echo 'Finished.'
30+
31+
if [[ "$BICON_NEXT" != "$BICON_CURRENT" ]]; then
32+
sed -i "s/$BICON_CURRENT/$BICON_NEXT/g" README.md
33+
echo "New bootstrap-icons version v$BICON_NEXT."
34+
else
35+
echo 'bootstrap-icons not upgraded.'
36+
fi
37+
38+
echo 'Run `yarn dev:cdn` and `yarn dev:vite` to make sure everything works.'

0 commit comments

Comments
 (0)