Skip to content

Commit

Permalink
build: robust packagecloud regexes, fixed token (hopefully)
Browse files Browse the repository at this point in the history
  • Loading branch information
natoscott committed Sep 8, 2023
1 parent 72e4406 commit 6c7a715
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions build/ci/packagecloud.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@
# Based on an (one file at a time) upload script here:
#https://github.com/danielmundi/upload-packagecloud/blob/main/push.sh

set -e

echo "Install dependencies"
sudo gem install package_cloud

#user=performancecopilot
user=natoscott
user=performancecopilot
repo=pcp
here=`pwd`

Expand All @@ -17,8 +14,14 @@ for build in artifacts/build-*
do
[ $build = "artifacts/build-*" ] && continue

# ex. artifacts/build-fedora31-container
dist=`echo $build | sed -e 's/^.*build-//' -e 's/-container$//' | awk '
# some examples...
# artifacts/build-fedora31-container
# artifacts/build-centos-stream9-container
# artifacts/build-centos6-container
# artifacts/build-debian11-container
# artifacts/build-ubuntu2204-container

dist=`echo $build | sed -e 's/^.*build-//' -e 's/-container.*$//' | awk '
BEGIN {
# map to any code names packagecloud expects
dist["debian10"] = "debian/buster";
Expand All @@ -30,8 +33,8 @@ BEGIN {
dist["ubuntu2204"] = "ubuntu/jammy";
}
$1 ~ /^debian/ || /^ubuntu/ { print dist[$1] }
$1 ~ /^fedora/ { match($1, /f.*([1-9][0-9]*)/, m); printf "fedora/%s\n", m[1] }
$1 ~ /^centos/ { match($1, /c.*([1-9][0-9]*)/, m); printf "el/%s\n", m[1] }
$1 ~ /^fedora/ { match($1, /fedora([1-9][0-9]*$)/, m); printf "fedora/%s\n", m[1] }
$1 ~ /^centos/ { match($1, /cent.*([1-9][0-9]*$)/, m); printf "el/%s\n", m[1] }
'`
[ -z "$dist" ] && continue

Expand Down

0 comments on commit 6c7a715

Please sign in to comment.