blob: 51f261a10378d0ed1e2fc37746dc5557e068de3a [file] [log] [blame]
Søren Gjessee6087bf2023-01-17 10:49:29 +01001#!/usr/bin/env python3
2# Copyright (c) 2023, the R8 project authors. Please see the AUTHORS file
3# for details. All rights reserved. Use of this source code is governed by a
4# BSD-style license that can be found in the LICENSE file.
5
6import argparse
7import sys
8
9import gmaven
Søren Gjessedf3cd962023-01-30 11:22:05 +010010import utils
Søren Gjessee6087bf2023-01-17 10:49:29 +010011
12ARCHIVE_BUCKET = 'r8-releases'
13REPO = 'https://github.com/google/smali'
14
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +020015
Søren Gjessee6087bf2023-01-17 10:49:29 +010016def parse_options():
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +020017 result = argparse.ArgumentParser(description='Release Smali')
18 result.add_argument('--version',
19 required=True,
20 metavar=('<version>'),
21 help='The version of smali to release.')
22 result.add_argument(
23 '--dry-run',
24 default=False,
25 action='store_true',
26 help='Only perform non-commiting tasks and print others.')
27 return result.parse_args()
Søren Gjessee6087bf2023-01-17 10:49:29 +010028
29
30def Main():
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +020031 options = parse_options()
32 utils.check_gcert()
33 gfile = ('/bigstore/r8-releases/smali/%s/smali-maven-release-%s.zip' %
34 (options.version, options.version))
35 release_id = gmaven.publisher_stage([gfile], options.dry_run)
Søren Gjessee6087bf2023-01-17 10:49:29 +010036
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +020037 print('Staged Release ID %s.\n' % release_id)
38 gmaven.publisher_stage_redir_test_info(
39 release_id, 'com.android.tools.smali:smali:%s' % options.version,
40 'smali.jar')
Søren Gjessee6087bf2023-01-17 10:49:29 +010041
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +020042 print()
43 answer = input('Continue with publishing [y/N]:')
Søren Gjessee6087bf2023-01-17 10:49:29 +010044
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +020045 if answer != 'y':
46 print('Aborting release to Google maven')
47 sys.exit(1)
Søren Gjessee6087bf2023-01-17 10:49:29 +010048
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +020049 gmaven.publisher_publish(release_id, options.dry_run)
Søren Gjessee6087bf2023-01-17 10:49:29 +010050
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +020051 print()
52 print('Published. Use the email workflow for approval.')
53
Søren Gjessee6087bf2023-01-17 10:49:29 +010054
55if __name__ == '__main__':
Christoffer Quist Adamsen2434a4d2023-10-16 11:29:03 +020056 sys.exit(Main())