#!/bin/bash -eux

# Install package_cloud gem in user's home directory
gem install --user-install package_cloud -v 0.3.14

# Add the user-installed gems bin directory to PATH
export PATH="$HOME/.local/share/gem/ruby/3.2.0/bin:$PATH"

set +x
echo "{\"url\":\"https://packagecloud.io\",\"token\": \"${PACKAGECLOUD_TOKEN}\"}" > ~/.packagecloud
set -x

# Verify the package_cloud command is available
which package_cloud || echo "package_cloud command not found in PATH: $PATH"

package_cloud push "${PACKAGECLOUD_USER}/npm/node" orchard-frontend-promo-player-builder-*.tgz
