forked from occiware/ecore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
promoteUpdateSite.sh
75 lines (61 loc) · 2.06 KB
/
promoteUpdateSite.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
#!/bin/bash
API=https://api.bintray.com
BINTRAY_USER=wpiers
BINTRAY_API_KEY=$KEY
BINTRAY_OWNER=wpiers
BINTRAY_REPO=generic
PCK_NAME=CloudDesigner
PCK_VERSION=0.1.0
PATH_TO_REPOSITORY=clouddesigner/org.occiware.clouddesigner.repository/target/repository
function main() {
deploy_updatesite
}
function deploy_updatesite() {
echo "${BINTRAY_USER}"
echo "${BINTRAY_API_KEY}"
echo "${BINTRAY_OWNER}"
echo "${BINTRAY_REPO}"
echo "${PCK_NAME}"
echo "${PCK_VERSION}"
echo "${PATH_TO_REPOSITORY}"
if [ ! -z "$PATH_TO_REPOSITORY" ]; then
cd $PATH_TO_REPOSITORY
fi
FILES=./*
BINARYDIR=./binary/*
PLUGINDIR=./plugins/*
FEATUREDIR=./features/*
for f in $FILES;
do
if [ ! -d $f ]; then
echo "Processing $f file..."
if [[ "$f" == *content.jar ]] || [[ "$f" == *artifacts.jar ]]
then
echo "Uploading p2 metadata file directly to the repository"
curl -X PUT -T $f -u ${BINTRAY_USER}:${BINTRAY_API_KEY} https://api.bintray.com/content/${BINTRAY_OWNER}/${BINTRAY_REPO}/$f;publish=0
else
curl -X PUT -T $f -u ${BINTRAY_USER}:${BINTRAY_API_KEY} https://api.bintray.com/content/${BINTRAY_OWNER}/${BINTRAY_REPO}/${PCK_NAME}/${PCK_VERSION}/$f;publish=0
fi
echo ""
fi
done
echo "Processing features dir $FEATUREDIR file..."
for f in $FEATUREDIR;
do
echo "Processing feature: $f file..."
curl -X PUT -T $f -u ${BINTRAY_USER}:${BINTRAY_API_KEY} https://api.bintray.com/content/${BINTRAY_OWNER}/${BINTRAY_REPO}/${PCK_NAME}/${PCK_VERSION}/$f;publish=0
echo ""
done
echo "Processing plugin dir $PLUGINDIR file..."
for f in $PLUGINDIR;
do
# take action on each file. $f store current file name
echo "Processing plugin: $f file..."
curl -X PUT -T $f -u ${BINTRAY_USER}:${BINTRAY_API_KEY} https://api.bintray.com/content/${BINTRAY_OWNER}/${BINTRAY_REPO}/${PCK_NAME}/${PCK_VERSION}/$f;publish=0
echo ""
done
echo "Processing binary dir $BINARYDIR file..."
echo "Publishing the new version"
curl -X POST -u ${BINTRAY_USER}:${BINTRAY_API_KEY} https://api.bintray.com/content/${BINTRAY_OWNER}/${BINTRAY_REPO}/${PCK_NAME}/${PCK_VERSION}/publish -d "{ \"discard\": \"false\" }"
}
main "$@"