Skip to content

Commit 64e0af3

Browse files
committed
Add release.sh build script
This script is adapted from the release.sh in Geofire for Java.
1 parent b890d9b commit 64e0af3

File tree

2 files changed

+85
-2
lines changed

2 files changed

+85
-2
lines changed

library/src/main/java/com/firebase/ui/FirebaseListAdapter.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public void onChanged(EventType type, int index, int oldIndex) {
8282
* combination of <code>limit()</code>, <code>startAt()</code>, and <code>endAt()</code>,
8383
*/
8484
public FirebaseListAdapter(Activity activity, Class<T> modelClass, int modelLayout, Firebase ref) {
85-
this(activity, modelClass, modelLayout, (Query)ref);
85+
this(activity, modelClass, modelLayout, (Query) ref);
8686
}
8787

8888
public void cleanup() {
@@ -96,7 +96,9 @@ public int getCount() {
9696
}
9797

9898
@Override
99-
public Object getItem(int i) { return mSnapshots.getItem(i); }
99+
public T getItem(int i) { return mSnapshots.getItem(i).getValue(mModelClass); }
100+
101+
public Firebase getRef(int position) { return mSnapshots.getItem(position).getRef(); }
100102

101103
@Override
102104
public long getItemId(int i) {

release.sh

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#!/bin/bash
2+
set -e
3+
4+
cd $(dirname $0)
5+
6+
###########################
7+
# VALIDATE GEOFIRE REPO #
8+
###########################
9+
# Ensure the checked out geofire branch is master
10+
CHECKED_OUT_BRANCH="$(git branch | grep "*" | awk -F ' ' '{print $2}')"
11+
if [[ $CHECKED_OUT_BRANCH != "master" ]]; then
12+
echo "Error: Your FirebaseUI-Android repo is not on the master branch."
13+
exit 1
14+
fi
15+
16+
# Make sure the geofire branch does not have existing changes
17+
if ! git --git-dir=".git" diff --quiet; then
18+
echo "Error: Your FirebaseUI-Android repo has existing changes on the master branch. Make sure you commit and push the new version before running this release script."
19+
exit 1
20+
fi
21+
22+
##############################
23+
# VALIDATE CLIENT VERSIONS #
24+
##############################
25+
26+
VERSION=$(grep version pom.xml |head -2|tail -1|awk -F '>' '{print $2}'|awk -F '<' '{print $1}'|awk -F '-' '{print $1}')
27+
read -p "We are releasing $VERSION, is this correct? (press enter to continue) " DERP
28+
if [[ ! -z $DERP ]]; then
29+
echo "Cancelling release, please update pom.xml to desired version"
30+
fi
31+
32+
# Ensure there is not an existing git tag for the new version
33+
# XXX this is wrong; needs to be semver sorted as my other scripts are
34+
LAST_GIT_TAG="$(git tag --list | tail -1 | awk -F 'v' '{print $2}')"
35+
if [[ $VERSION == $LAST_GIT_TAG ]]; then
36+
echo "Error: git tag v${VERSION} already exists. Make sure you are not releasing an already-released version."
37+
exit 1
38+
fi
39+
40+
# Create docs
41+
./create-docs.sh
42+
if [[ $? -ne 0 ]]; then
43+
echo "error: There was an error creating the docs."
44+
exit 1
45+
fi
46+
47+
###################
48+
# DEPLOY TO MAVEN #
49+
###################
50+
read -p "Next, make sure this repo is clean and up to date. We will be kicking off a deploy to maven." DERP
51+
mvn clean
52+
mvn release:clean release:prepare release:perform -Dtag=v$VERSION
53+
54+
if [[ $? -ne 0 ]]; then
55+
echo "error: Error building and releasing to maven."
56+
exit 1
57+
fi
58+
59+
##############
60+
# UPDATE GIT #
61+
##############
62+
63+
# Push the new git tag created by Maven
64+
git push --tags
65+
if [[ $? -ne 0 ]]; then
66+
echo "Error: Failed to do 'git push --tags' from geofire repo."
67+
exit 1
68+
fi
69+
70+
################
71+
# MANUAL STEPS #
72+
################
73+
74+
echo "Manual steps:"
75+
echo " 1) release maven repo at http://oss.sonatype.org/"
76+
echo " 2) Deploy new docs: $> firebase deploy"
77+
echo " 3) Update the release notes for FirebaseUI-Android version ${VERSION} on GitHub and add jars for downloading"
78+
echo " 4) Update firebase-versions.json in the firebase-clients repo with the changelog information"
79+
echo " 5) Tweet @FirebaseRelease: 'v${VERSION} of FirebaseUI-Android is available https://github.com/firebase/FirebaseUI-Android"
80+
echo ---
81+
echo "Done! Woo!"

0 commit comments

Comments
 (0)