Skip to content

Commit ca24e9b

Browse files
authored
Merge pull request #1 from gizmoguy/republish
Allow republishing the same version of a package
2 parents 11acf03 + de71fd6 commit ca24e9b

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

entrypoint.sh

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,19 @@ export LANG=C.UTF-8
1414
function upload_rpm {
1515
distro=$2
1616
pkg_filename="$(basename "$1")"
17-
rev_filename=`echo ${pkg_filename} | rev`
17+
rev_filename=$(echo "${pkg_filename}" | rev)
1818

19-
pkg_name=`echo ${rev_filename} | cut -d '-' -f3- | rev`
20-
pkg_version=`echo ${rev_filename} | cut -d '-' -f1-2 | rev | cut -d '.' -f1-3`
21-
pkg_arch=`echo ${rev_filename} | cut -d '.' -f2 | rev`
22-
pkg_rel=`echo ${rev_filename} | cut -d '.' -f3 | rev`
23-
releasever="${pkg_rel:2}"
19+
pkg_name=$(echo "${rev_filename}" | cut -d '-' -f3- | rev)
20+
pkg_version=$(echo "${rev_filename}" | cut -d '-' -f1-2 | rev | cut -d '.' -f1-3)
21+
pkg_arch=$(echo "${rev_filename}" | cut -d '.' -f2 | rev)
22+
pkg_rel=$(echo "${rev_filename}" | cut -d '.' -f3 | rev)
23+
release_ver="${pkg_rel:2}"
2424

25-
cloudsmith push rpm ${CLOUDSMITH_REPO}/${distro}/${releasever} ${1}
25+
cloudsmith push rpm --republish "${CLOUDSMITH_REPO}/${distro}/${release_ver}" "${1}"
2626
}
2727

2828
function upload_deb {
29-
30-
cloudsmith push deb ${CLOUDSMITH_REPO}/${2}/${3} ${1}
29+
cloudsmith push deb --republish "${CLOUDSMITH_REPO}/${2}/${3}" "${1}"
3130
}
3231

3332
function cloudsmith_upload {
@@ -36,11 +35,11 @@ function cloudsmith_upload {
3635
pkg_fullpath=$3
3736

3837
if [[ ${linux_distro} =~ centos ]]; then
39-
upload_rpm ${pkg_fullpath} "centos"
38+
upload_rpm "${pkg_fullpath}" "centos"
4039
elif [[ ${linux_distro} =~ fedora ]]; then
41-
upload_rpm ${pkg_fullpath} "fedora"
40+
upload_rpm "${pkg_fullpath}" "fedora"
4241
else
43-
upload_deb ${pkg_fullpath} ${linux_distro} ${linux_release}
42+
upload_deb "${pkg_fullpath}" "${linux_distro}" "${linux_release}"
4443
fi
4544
}
4645

@@ -51,8 +50,6 @@ do
5150
IFS=_ read -r distro release <<< "$(basename "${path}")"
5251
while IFS= read -r -d '' pkg
5352
do
54-
cloudsmith_upload "${distro}" "${release}" "${pkg}"
53+
cloudsmith_upload "${distro}" "${release}" "${pkg}"
5554
done < <(find "${path}" -maxdepth 1 -type f -print0)
5655
done < <(find "${PACKAGE_LOCATION}" -mindepth 1 -maxdepth 1 -type d -print0)
57-
58-

0 commit comments

Comments
 (0)