This repository has been archived by the owner on Dec 29, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 272
/
release.sh
executable file
·82 lines (69 loc) · 2.71 KB
/
release.sh
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
#!/bin/bash
set -e
cd $(dirname $0)
###########################
# VALIDATE GEOFIRE REPO #
###########################
# Ensure the checked out geofire branch is master
CHECKED_OUT_BRANCH="$(git branch | grep "*" | awk -F ' ' '{print $2}')"
if [[ $CHECKED_OUT_BRANCH != "master" ]]; then
echo "Error: Your geofire repo is not on the master branch."
exit 1
fi
# Make sure the geofire branch does not have existing changes
if ! git --git-dir=".git" diff --quiet; then
echo "Error: Your geofire repo has existing changes on the master branch. Make sure you commit and push the new version before running this release script."
exit 1
fi
##############################
# VALIDATE CLIENT VERSIONS #
##############################
VERSION=$(grep version pom.xml |head -2|tail -1|awk -F '>' '{print $2}'|awk -F '<' '{print $1}'|awk -F '-' '{print $1}')
read -p "We are releasing $VERSION, is this correct? (press enter to continue) " DERP
if [[ ! -z $DERP ]]; then
echo "Cancelling release, please update pom.xml to desired version"
fi
# Ensure there is not an existing git tag for the new version
# XXX this is wrong; needs to be semver sorted as my other scripts are
LAST_GIT_TAG="$(git tag --list | tail -1 | awk -F 'v' '{print $2}')"
if [[ $VERSION == $LAST_GIT_TAG ]]; then
echo "Error: git tag v${VERSION} already exists. Make sure you are not releasing an already-released version."
exit 1
fi
# Create docs
./create-docs.sh
if [[ $? -ne 0 ]]; then
echo "error: There was an error creating the docs."
exit 1
fi
###################
# DEPLOY TO MAVEN #
###################
read -p "Next, make sure this repo is clean and up to date. We will be kicking off a deploy to maven." DERP
mvn clean
mvn -s settings.xml release:clean release:prepare release:perform -Darguments="-DskipTests" -Dtag=v$VERSION
if [[ $? -ne 0 ]]; then
echo "error: Error building and releasing to maven."
exit 1
fi
##############
# UPDATE GIT #
##############
# Push the new git tag created by Maven
git push --tags
if [[ $? -ne 0 ]]; then
echo "Error: Failed to do 'git push --tags' from geofire repo."
exit 1
fi
################
# MANUAL STEPS #
################
echo "Manual steps:"
echo " 1) Release all draft artifacts on Bintray at https://bintray.com/firebase/geofire"
echo " 2) On bintray, initiate Maven Central sync for latest version"
echo " 3) Deply new docs: $> firebase deploy"
echo " 4) Update the release notes for GeoFire version ${VERSION} on GitHub and add jars for downloading"
echo " 5) Update firebase-versions.json in the firebase-clients repo with the changelog information"
echo " 6) Tweet @FirebaseRelease: 'v${VERSION} of @Firebase GeoFire for Java is available https://github.com/firebase/geofire-java"
echo ---
echo "Done! Woo!"