Last active
April 22, 2019 17:34
-
-
Save mirland/5a8c24196c0fd4408adaabfdab6f198a to your computer and use it in GitHub Desktop.
SNAPSHOT Beta release using jenkins
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "Current branch: $GIT_BRANCH" | |
MAIN_SNAPSHOT_BRANCH="origin/develop" | |
GRADLE_FILE="app/build.gradle" | |
CURRENT_COMMIT_HASH=$(git rev-parse --short HEAD) | |
IS_BETA_SNAPSHOT_BUILD=false | |
if [[ $GIT_BRANCH == $MAIN_SNAPSHOT_BRANCH ]] ; then # Cheks if this build is a beta release | |
IS_BETA_SNAPSHOT_BUILD=true; # Set that the build is a beta snapshot release | |
TESTER_GROUP='testers' # Set the beta notification group | |
# Update version name | |
VERSION_NAME=$(sed -n -e "s/\s*versionName\s*[\"\']\(.*\)[\"\']\s*/\1/p" $GRADLE_FILE) | |
NEXT_VERSION_NAME="$VERSION_NAME-$CURRENT_COMMIT_HASH" | |
sed -i -e "s/\(\s*versionName\s*[\"\']\).*\([\"\']\s*\)/\1$NEXT_VERSION_NAME\2/" $GRADLE_FILE | |
# Create the release notes | |
git log --pretty=format:"$NEXT_VERSION_NAME: - %s%n%n" -n 1 > release_notes.txt | |
git log --pretty=format:"Author: %an <%ae>%n%B" -n 1 >> release_notes.txt | |
echo -e "\n\nLast 10 changes\n" >> release_notes.txt | |
git log --pretty=format:"• %s (%an - %ci)" HEAD~11..HEAD^ >> release_notes.txt | |
fi | |
echo "TESTER_GROUP=$TESTER_GROUP" > build.properties # Tester beta group to be notified | |
echo "IS_BETA_SNAPSHOT_BUILD=$IS_BETA_BUILD" >> build.properties # Property that check if it's a SNAPSHOT build. | |
echo "Property file: " | |
cat build.properties |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment