Top 5 only.

This commit is contained in:
Tingluo Huang
2023-09-22 21:37:54 +00:00
parent b9a893e847
commit 3e15aceec9
14 changed files with 10 additions and 986 deletions
+6 -54
View File
@@ -1,8 +1,6 @@
#!/bin/bash
# Usage: script/build.sh [ssh|https]
# ssh Force SSH clone URLs
# https Force HTTPS clone URLs
# Usage: script/build.sh
set -e
@@ -12,44 +10,6 @@ script_dir="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
# Trace
. $script_dir/internal/set-trace.sh
while test $# -gt 0; do
case "$1" in
-no-verify)
NO_VERIFY=1;
shift
;;
*)
# Protocol is the only unnamed arg
protocol="$1"
shift;
;;
esac
done
# validate protocol input and set default arg
# need to do this here because the above loop doesn't run ifthere are no args
protocol="$(echo "$protocol" | tr a-z A-Z)"
if [ -z "$protocol" ]; then
# Note:
# - Use "-o" instead of "--only-matching" for compatibility
# - Use "-F" instead of "--fixed-strings" for compatibility
if [ -n "$( (git remote get-url origin | grep -o -F 'git@github.com:') || : )" ]; then
protocol='SSH'
else
protocol='HTTPS'
fi
elif [ "$protocol" != 'HTTPS' -a "$protocol" != 'SSH' ]; then
echo "Invalid protocol '$protocol'. Expected 'https' or 'ssh'."
exit 1
fi
# validate sha256sum tool is installed to check runner SHA's
if ! command -v sha256sum &> /dev/null && [ -z "$NO_VERIFY" ]
then
echo "sha256sum tool not installed, you may need to 'brew install coreutils or pass in -no-verify'"
exit 1
fi
# Generate action scripts
if [ -z "$GENERATE_ACTION_SCRIPTS" ]; then
"$script_dir/internal/generate-scripts.sh"
@@ -67,15 +27,7 @@ rm -rf "$layout_dir"
mkdir -p "$layout_dir"
# Remote URL prefix
url_prefix='git@github.com:'
if [ $protocol = 'HTTPS' ]; then
url_prefix='https://github.com/'
fi
# Use checked-in known_hosts, dont check IP
if [ "$protocol" = 'SSH' ]; then
export GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=yes -o CheckHostIP=no -o UserKnownHostsFile=$script_dir/internal/known_hosts"
fi
url_prefix='https://github.com/'
# Create each repo
pushd "$layout_dir"
@@ -102,17 +54,17 @@ cp -r "$layout_dir" "$zipball_layout_dir"
pushd "$zipball_layout_dir"
find . -type f -name "*.tar.gz" -delete
ls -l -R ./
echo "Creating action_cache_zipball in ${zipball_layout_dir}"
pwsh -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command "Compress-Archive -Path \"${zipball_layout_dir}\" -DestinationPath \"${layout_dir}\action_cache.zip\""
echo "Creating action_versions_zipball in ${zipball_layout_dir}"
pwsh -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command "Compress-Archive -Path \"${zipball_layout_dir}\" -DestinationPath \"${layout_dir}\action_versions.zip\""
popd
cp -r "$layout_dir" "$tarball_layout_dir"
pushd "$tarball_layout_dir"
find . -type f -name "*.zip" -delete
ls -l -R ./
echo "Creating action_cache.tar.gz in ${tarball_layout_dir}"
echo "Creating action_versions.tar.gz in ${tarball_layout_dir}"
pushd "$layout_dir"
tar -czf "action_cache.tar.gz" -C "${tarball_layout_dir}" .
tar -czf "action_versions.tar.gz" -C "${tarball_layout_dir}" .
popd
popd