mentat/automation/taskcluster/release/fetch-bintray-api-key.py
Nick Alexander 67a14ca756 [sdks/android] Build Mentat Android SDK in TaskCluster; publish org.mozilla.mentat to nalexander's personal Bintray repo.
The automation parts were cribbed directly from
50add3e176.

The automation permissions were added in
https://bugzilla.mozilla.org/show_bug.cgi?id=1477311.

This uses a very rudimentary Gradle plugin, `rust-android-gradle`,
with custom fixes and extensions.  It works pretty well for what it
is!  See https://github.com/ncalexan/rust-android-gradle.
2018-07-25 20:50:44 -07:00

29 lines
1.1 KiB
Python

# 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/.
import os
import taskcluster
SECRET_NAME = 'project/mentat/publish'
TASKCLUSTER_BASE_URL = 'http://taskcluster/secrets/v1'
def fetch_publish_secrets(secret_name):
"""Fetch and return secrets from taskcluster's secret service"""
secrets = taskcluster.Secrets({'baseUrl': TASKCLUSTER_BASE_URL})
return secrets.get(secret_name)
def main():
"""Fetch the bintray user and api key from taskcluster's secret service
and save it to local.properties in the project root directory.
"""
data = fetch_publish_secrets(SECRET_NAME)
properties_file_path = os.path.join(os.path.dirname(__file__), '../../../sdks/android/Mentat/local.properties')
with open(properties_file_path, 'w') as properties_file:
properties_file.write("bintray.user=%s\n" % data['secret']['bintray_user'])
properties_file.write("bintray.apikey=%s\n" % data['secret']['bintray_apikey'])
if __name__ == "__main__":
main()