Skip to content

Commit adbf3e0

Browse files
authored
Merge pull request #83 from leamas/cs-upload-fixes
ci: cloudsmith: Use stable repo for tagged commits.
2 parents 6c8a086 + 32ee14a commit adbf3e0

File tree

2 files changed

+35
-5
lines changed

2 files changed

+35
-5
lines changed

ci/appveyor-upload.sh

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
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

910
if [ "$(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
2728
commit=$(git rev-parse --short=7 HEAD) || commit="unknown"
2829
now=$(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+
3036
tarball=$(ls *.tar.gz)
3137
xml=$(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

ci/circleci-upload.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
set -xe
1616

17-
STABLE_REPO=${CLOUDSMITH_STABLE_REPO:-'mauro-calvi/squiddio-pi'}
17+
STABLE_REPO=${CLOUDSMITH_STABLE_REPO:-'mauro-calvi/squiddio-stable'}
1818
UNSTABLE_REPO=${CLOUDSMITH_UNSTABLE_REPO:-'mauro-calvi/squiddio-pi'}
1919

2020
if [ -z "$CIRCLECI" ]; then

0 commit comments

Comments
 (0)