blob: a48d39cffdf39b854bf35b9850f8d6f034275277 [file] [log] [blame]
Lott, Christopher (cl778h)868ab362019-07-31 15:32:03 -04001#!/bin/bash -l
2# SPDX-License-Identifier: EPL-1.0
3##############################################################################
4# Copyright (c) 2019 The Linux Foundation and others.
5#
6# All rights reserved. This program and the accompanying materials
7# are made available under the terms of the Eclipse Public License v1.0
8# which accompanies this distribution, and is available at
9# http://www.eclipse.org/legal/epl-v10.html
10##############################################################################
11echo "---> packagecloud-push.sh"
12set -eu -o pipefail
13
14if [ ! -f ~/.packagecloud ]; then
15 echo "INFO: .packagecloud file not found"
16 exit 0
17fi
18
19 # For DEB
20vers=("$DEBIAN_DISTRIBUTION_VERSIONS")
21echo "Debian distribution versions:" "${vers[@]}"
22debs=$(find . -type f -iname '*.deb')
23# modern bash syntax is helpful
24for (( i = 0; i < ${#vers[@]}; i++ )); do
25 for deb in $debs; do
26 echo "Pushing $deb $PACKAGECLOUD_ACCOUNT/$PACKAGECLOUD_REPO/${vers[i]}"
27 package_cloud push "$PACKAGECLOUD_ACCOUNT"/"$PACKAGECLOUD_REPO"/"${vers[i]}" "$deb"
28 done
29done
30
31# For RPM
32vers=("$RPM_DISTRIBUTION_VERSIONS")
33echo "RPM distribution versions:" "${vers[@]}"
34rpms=$(find . -type f -iregex '.*/.*\.\(s\)?rpm')
35# modern bash syntax is helpful
36for (( i = 0; i < ${#vers[@]}; i++ )); do
37 for rpm in $rpms; do
38 echo "Pushing $rpm $PACKAGECLOUD_ACCOUNT/$PACKAGECLOUD_REPO/${vers[i]}"
39 package_cloud push "$PACKAGECLOUD_ACCOUNT"/"$PACKAGECLOUD_REPO"/"${vers[i]}" "$rpm"
40 done
41done