44# Upload the .tar.gz and .xml artifacts to cloudsmith
55#
66
7- REPO=' mauro-calvi/squiddio-pi'
7+ STABLE_REPO=${CLOUDSMITH_STABLE_REPO:- ' mauro-calvi/squiddio-stable' }
8+ UNSTABLE_REPO=${CLOUDSMITH_UNSTABLE_REPO:- ' mauro-calvi/squiddio-pi' }
89
910if [ " $( git rev-parse master) " != " $( git rev-parse HEAD) " ]; then
1011 echo " Not on master branch, skipping deployment."
@@ -27,9 +28,38 @@ python -m pip install -q cloudsmith-cli
2728commit=$( git rev-parse --short=7 HEAD) || commit=" unknown"
2829now=$( date --rfc-3339=seconds) || now=$( date)
2930
31+
32+ BUILD_ID=${APPVEYOR_BUILD_NUMBER:- 1}
33+ commit=$( git rev-parse --short=7 HEAD) || commit=" unknown"
34+ tag=$( git tag --contains HEAD)
35+
3036tarball=$( ls * .tar.gz)
3137xml=$( ls * .xml)
32- echo ' <!--' " Date: $now Commit: $commit Build nr: $BUILD_ID -->" >> $xml
3338
34- cloudsmith push raw --republish --no-wait-for-sync $REPO $tarball
35- cloudsmith push raw --republish --no-wait-for-sync $REPO $xml
39+ source ../build/pkg_version.sh
40+ test -n " $tag " && VERSION=" $tag " || VERSION=" ${VERSION} +${BUILD_ID} .${commit} "
41+ test -n " $tag " && REPO=" $STABLE_REPO " || REPO=" $UNSTABLE_REPO "
42+
43+ if [ -n " $tag " ]; then
44+ # There is no sed available in git bash. This is nasty, but seems
45+ # to work:
46+ while read line; do
47+ echo ${line/ squiddio-pi/ squiddio-stable}
48+ done < $xml > xml.tmp && cp xml.tmp $xml && rm xml.tmp
49+ fi
50+
51+ cloudsmith push raw \
52+ --republish \
53+ --no-wait-for-sync \
54+ --name squiddio-${PKG_TARGET} -${PKG_TARGET_VERSION} -metadata \
55+ --version ${VERSION} \
56+ --summary " squiddio opencpn plugin metadata for automatic installation" \
57+ $REPO $xml
58+
59+ cloudsmith push raw \
60+ --republish \
61+ --no-wait-for-sync \
62+ --name squiddio-${PKG_TARGET} -${PKG_TARGET_VERSION} -tarball \
63+ --version ${VERSION} \
64+ --summary " squiddio opencpn plugin tarball for automatic installation" \
65+ $REPO $tarball
0 commit comments