-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease.sh
executable file
·132 lines (107 loc) · 3.27 KB
/
release.sh
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
no_publish=false
keep_open=false
publish_only=false
while test $# -gt 0; do
case "$1" in
-h|--help)
echo "release - Release Prodege AdMob Android Adapter"
echo " "
echo "release [options]"
echo " "
echo "options:"
echo "-h, --help show brief help"
echo "--publish-only execute only publishing tasks"
echo "--no-publish skip publishing tasks"
echo "--keep-open keep sonatype repository open and don't release"
exit 0
;;
--no-publish*)
shift
no_publish=true
keep_open=true
shift
;;
--keep-open*)
keep_open=true
shift
;;
--publish-only*)
publish_only=true
shift
;;
esac
done
if [ "$publish_only" = false ] ; then
# Clean build folder
if ./gradlew clean; then
echo "Clean task succeeded"
else
echo "Clean task failed"
exit 1
fi
# Build Prodege AdMob Adapter
if ./gradlew :prodege-admob:build; then
echo "Build task succeeded"
else
echo "Build task failed"
fi
if ./gradlew :prodege-admob:build; then
echo "Build task succeeded"
else
echo "Build task failed."
fi
# Package public distribution .zip files
if ./gradlew :prodege:packageDistributions; then
echo "Packing Distributions succeeded"
else
echo "Packing Distributions failed"
exit 1
fi
else
echo "Skipping Building"
fi
if [ "$no_publish" = false ] ; then
# Upload Prodege AdMob Adapter aar to Sonatype repository
if ./gradlew :prodege:publishAllPublicationsToSonatypeRepository; then
echo "Upload to Sonatype tak succeeded"
else
echo "Upload to Sonatype task failed"
exit 1
fi
for entry in prodege-admob/build/dist/public/*
do
file_name="${entry##*/}"
slashed_entry="${entry// /\\ }"
# Upload public dist .zip files to Google Cloud Bucket
eval "gsutil cp ${slashed_entry} gs://pollfish_production/sdk/AdMob/"
if [ $? -eq 0 ]; then
echo "Upload ${file_name} succeeded"
else
echo "Upload ${file_name} failed"
exit 1
fi
slashed_file_name="${file_name// /\\ }"
# Add Public Read Permission to Google Cloud objects
eval "gsutil acl ch -u AllUsers:R gs://pollfish_production/sdk/AdMob/${slashed_file_name}"
if [ $? -eq 0 ]; then
echo "${file_name} is now public"
echo "URL: https://storage.googleapis.com/pollfish_production/sdk/AdMob/${file_name// /%20}"
else
echo "Failed to add public access permission to: ${file_name}"
exit 1
fi
done
else
echo "Skipping Publishing"
fi
if [ "$keep_open" = false ] ; then
# Keep Sonatype staging repository open and do not release
if ./gradlew :closeAndReleaseRepository; then
echo "Closing Maven repository task succeeded"
else
echo "Closing Maven repository task failed"
exit 1
fi
else
echo "Skipping Close/Release Maven Repository"
fi