forked from wikimedia/apps-android-wikipedia
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupload-all.py
More file actions
executable file
·60 lines (48 loc) · 1.57 KB
/
Copy pathupload-all.py
File metadata and controls
executable file
·60 lines (48 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env python
"""
Uploads all built APKs to the Wikimedia releases server.
Requirements:
- SCP must be available in PATH
- SSH key authentication must be set up for releases.discovery.wmnet
- APK files must exist in the releases/ directory
"""
import glob
import subprocess
import sys
# Upload configuration
UPLOAD_CONFIGS = [
{
'name': 'beta',
'pattern': './releases/wikipedia-*-beta*.apk',
'path': 'releases.discovery.wmnet:/srv/org/wikimedia/releases/mobile/android/wikipedia/betas/'
},
{
'name': 'stable',
'pattern': './releases/wikipedia-*-r*.apk',
'path': 'releases.discovery.wmnet:/srv/org/wikimedia/releases/mobile/android/wikipedia/stable/'
}
]
def upload_apks(name, pattern, upload_path):
"""Upload APK files matching the pattern to the specified path"""
files = glob.glob(pattern)
if files:
try:
subprocess.run(['scp'] + files + [upload_path], check=True)
return True
except subprocess.CalledProcessError as e:
print(f"✗ Failed to upload {name} APKs: {e}")
sys.exit(1)
else:
print(f"No {name} APKs found to upload")
return False
def main():
upload_count = 0
for config in UPLOAD_CONFIGS:
if upload_apks(config['name'], config['pattern'], config['path']):
upload_count += 1
if upload_count == 0:
print("No APK files found to upload.")
sys.exit(1)
print(f"\n✓ {upload_count} uploads completed successfully!")
if __name__ == '__main__':
main()