-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·128 lines (104 loc) · 3.23 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
no_publish=false
keep_open=false
publish_only=false
while test $# -gt 0; do
case "$1" in
-h|--help)
echo "release - Release Prodege IronSource 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
no_upload=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 IronSource Adapter
if ./gradlew :prodege-ironsource:build; then
echo "Build task succeeded"
else
echo "Build task failed"
exit 1
fi
# Package public distribution .zip files
if ./gradlew :prodege-ironsource: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 IronSource Adapter aar to Sonatype repository
if ./gradlew :prodege-ironsource:publishAllPublicationsToSonatypeRepository; then
echo "Upload to Sonatype tak succeeded"
else
echo "Upload to Sonatype task failed"
exit 1
fi
for entry in prodege-ironsource/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/IronSource/"
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/IronSource/${slashed_file_name}"
if [ $? -eq 0 ]; then
echo "${file_name} is now public"
echo "URL: https://storage.googleapis.com/pollfish_production/sdk/IronSource/${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