-
Notifications
You must be signed in to change notification settings - Fork 2
/
upload
executable file
·59 lines (46 loc) · 1.54 KB
/
upload
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
#!/bin/sh
set -e
if test -z "$bintray_api_key"; then
echo 'bintray_api_key must be set'
exit 2
fi
curl_verbose=
delete_package() {
file="$1"
package=`echo $file |sed -e 's/.tar.xz$//' -e 's/.zip$//'`
if curl $curl_verbose -f -uop:$bintray_api_key https://api.bintray.com/packages/pycurl/deps/$package; then
echo "Delete $package"
curl $curl_verbose -f -uop:$bintray_api_key -X DELETE https://api.bintray.com/packages/pycurl/deps/$package
fi
}
upload() {
file="$1"
path="$2"
package=`echo $file |sed -e 's/.tar.xz$//' -e 's/.zip$//'`
version=1.0
curl -sfIL https://api.bintray.com/packages/pycurl/deps/$package || (
data=$(cat <<-EOT
{"name":"$package",
"licenses":["LGPL-2.1", "MIT"],
"vcs_url":"https://github.com/pycurl/pycurl"}
EOT
) &&
curl -sfd "$data" -uop:$bintray_api_key -Hcontent-type:application/json https://api.bintray.com/packages/pycurl/deps
)
curl -sfIL https://api.bintray.com/packages/pycurl/deps/$package/versions/$version || (
data=$(cat <<-EOT
{"name":"$version"}
EOT
) &&
curl -sfd "$data" -uop:$bintray_api_key -Hcontent-type:application/json https://api.bintray.com/packages/pycurl/deps/$package/versions
)
curl -sfT $path -uop:$bintray_api_key https://api.bintray.com/content/pycurl/deps/$package/$version/$file'?publish=1'
}
files=`git ls-files |grep tar.xz$`
files=`echo appveyor/*.zip`
for path in $files; do
file=`basename $path`
echo $file
delete_package $file
curl -sfIL "https://dl.bintray.com/pycurl/deps/$file" || upload $file $path
done