Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pin Android Components version and add script for automated updates. #1050

Merged
merged 2 commits into from Mar 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
56 changes: 56 additions & 0 deletions automation/taskcluster/update_android_components.sh
@@ -0,0 +1,56 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

# If a command fails then do not proceed and fail this script too.
set -ex

# Install dependencies (TODO: Move to Docker image)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:Should we open an issue to keep track of it? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

apt-get install -y brew
brew install hub

BRANCH="ac-update"
USER="MickeyMoz"
EMAIL="sebastian@mozilla.com"
REPO="reference-browser"

git config --global user.email $EMAIL
git config --global user.name $USER

# Fetching latest version
LATEST_VERSION=`curl https://nightly.maven.mozilla.org/maven2/org/mozilla/components/browser-engine-gecko-nightly/maven-metadata.xml | sed -ne '/latest/{s/.*<latest>\(.*\)<\/latest>.*/\1/p;q;}'`

# Updating version file
sed -i "s/VERSION = \".*\"/VERSION = \"$LATEST_VERSION\"/g" "buildSrc/src/main/java/AndroidComponents.kt"

# Create a branch and commit local changes
git checkout -b $BRANCH
git add buildSrc/src/main/java/AndroidComponents.kt
git commit -m \
"Update Android Components version to $LATEST_VERSION." \
--author="MickeyMoz <sebastian@mozilla.com>" \
|| { echo "No new Android Components version ($LATEST_VERSTION) available"; exit 0; }

# Get token for using GitHub
python automation/taskcluster/helper/get-secret.py \
-s project/mobile/github \
-k botAccountToken \
-f .github_token \

# From here on we do not want to print the commands since they contain tokens
set +x

GITHUB_TOKEN=`cat .github_token`
URL="https://$USER:$GITHUB_TOKEN@github.com/$USER/$REPO/"

# Push changes to GitHub
echo "Pushing branch to GitHub"
git push -f --no-verify --quiet $URL $BRANCH > /dev/null 2>&1 || echo "Failed ($?)"

# Open a PR if needed
if [[ $(hub pr list -h $USER:$BRANCH) ]]; then
echo "There's already an open PR."
else
echo "No PR found. Opening new PR."
hub pull-request -b master -h MickeyMoz:ac-update --no-edit -m "Update Android Components version"
fi
7 changes: 7 additions & 0 deletions buildSrc/src/main/java/AndroidComponents.kt
@@ -0,0 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

object AndroidComponents {
const val VERSION = "35.0.20200303130104"
}
2 changes: 1 addition & 1 deletion buildSrc/src/main/java/Dependencies.kt
Expand Up @@ -16,7 +16,7 @@ private object Versions {

const val android_gradle_plugin = "3.4.1"

const val mozilla_android_components = "+" // Always use the latest snapshot
const val mozilla_android_components = AndroidComponents.VERSION

const val thirdparty_sentry = "1.7.10"

Expand Down