Skip to content

Commit e482d69

Browse files
authored
Merge pull request element-hq#12374 from vector-im/jryans/release-tag-tweaks
Automate SDK dep upgrades for release
2 parents 08c149e + 585d40f commit e482d69

1 file changed

Lines changed: 35 additions & 7 deletions

File tree

‎release.sh‎

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,29 +21,57 @@ cd `dirname $0`
2121
for i in matrix-js-sdk matrix-react-sdk
2222
do
2323
depver=`cat package.json | jq -r .dependencies[\"$i\"]`
24-
latestver=`yarn info -s $i version`
24+
latestver=`yarn info -s $i dist-tags.next`
2525
if [ "$depver" != "$latestver" ]
2626
then
27-
echo "The latest version of $i is $latestver but package.json depends on $depver"
28-
echo -n "Type 'Yes' to continue anyway: "
27+
echo "The latest version of $i is $latestver but package.json depends on $depver."
28+
echo -n "Type 'u' to auto-upgrade, 'c' to continue anyway, or 'a' to abort:"
2929
read resp
30-
if [ "$resp" != "Yes" ]
30+
if [ "$resp" != "u" ] && [ "$resp" != "c" ]
3131
then
32-
echo "OK, never mind."
32+
echo "Aborting."
3333
exit 1
3434
fi
35+
if [ "$resp" == "u" ]
36+
then
37+
echo "Upgrading $i to $latestver..."
38+
yarn add -E $i@$latestver
39+
git add -u
40+
# The `-e` flag opens the editor and gives you a chance to check
41+
# the upgrade for correctness.
42+
git commit -m "Upgrade $i to $latestver" -e
43+
fi
3544
fi
3645
done
3746

38-
# bump Electron's package.json first
3947
release="${1#v}"
4048
tag="v${release}"
41-
echo "electron yarn version"
49+
prerelease=0
50+
# We check if this build is a prerelease by looking to
51+
# see if the version has a hyphen in it. Crude,
52+
# but semver doesn't support postreleases so anything
53+
# with a hyphen is a prerelease.
54+
echo $release | grep -q '-' && prerelease=1
4255

56+
# bump Electron's package.json first
57+
echo "electron yarn version"
4358
cd electron_app
4459
yarn version --no-git-tag-version --new-version "$release"
4560
git commit package.json -m "$tag"
4661

4762
cd ..
4863

4964
exec ./node_modules/matrix-js-sdk/release.sh -u vector-im -z "$orig_args"
65+
66+
if [ $prerelease -eq 0 ]
67+
then
68+
# For a release, reset SDK deps back to the `develop` branch.
69+
for i in matrix-js-sdk matrix-react-sdk
70+
do
71+
echo "Resetting $i to develop branch..."
72+
yarn add github:matrix-org/$i#develop
73+
git add -u
74+
git commit -m "Reset $i back to develop branch"
75+
done
76+
git push origin develop
77+
fi

0 commit comments

Comments
 (0)