Add more messaging to scripts.
This commit is contained in:
parent
feb88c8d01
commit
35fdd91f0f
2 changed files with 11 additions and 12 deletions
|
@ -6,16 +6,18 @@ set -e
|
|||
version=$1
|
||||
packages=${@:2}
|
||||
|
||||
echo "* Creating cache key..."
|
||||
echo "::group::Create Cache Key"
|
||||
|
||||
# Remove package delimiters, sort (requires newline) and then convert back to inline list.
|
||||
normalized_list=$(echo $packages | sed 's/[\s,]+/ /g' | tr ' ' '\n' | sort | tr '\n' ' ')
|
||||
echo "* Normalized package list is '$normalized_list'."
|
||||
echo "::debug::Normalized package list is '$normalized_list'."
|
||||
|
||||
value=$(echo $normalized_list @ $version)
|
||||
echo "* Value to hash is '$value'."
|
||||
echo "::debug::Value to hash is '$value'."
|
||||
|
||||
key=$(echo $value | md5sum | /bin/cut -f1 -d' ')
|
||||
echo "* Value hashed as '$key'."
|
||||
echo "::debug::Value hashed as '$key'."
|
||||
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "CACHE_KEY=$key" >> $GITHUB_ENV
|
|
@ -3,28 +3,25 @@
|
|||
version=$1
|
||||
packages=${@:2}
|
||||
|
||||
echo -n "* Validating action arguments... ";
|
||||
echo -n "::group::Validate Action Arguments";
|
||||
|
||||
echo $version | grep -o " " > /dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "aborted."
|
||||
echo "* Version value '$version' cannot contain spaces." >&2
|
||||
echo "::error::Aborted. Version value '$version' cannot contain spaces." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$packages" == "" ]; then
|
||||
echo "aborted."
|
||||
echo "* Packages argument cannot be empty." >&2
|
||||
echo "::error::Aborted. Packages argument cannot be empty." >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
for package in $packages; do
|
||||
apt-cache search ^$package$ | grep $package > /dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "aborted."
|
||||
echo "* Package '$package' not found." >&2
|
||||
echo "::error::Aborted. Package '$package' not found." >&2
|
||||
exit 3
|
||||
fi
|
||||
done
|
||||
|
||||
echo "done."
|
||||
echo "::endgroup::"
|
||||
|
|
Loading…
Reference in a new issue