@@ -17,12 +17,29 @@ if [[ "$(find . -name "$updated_at_file" -mtime +21)" != "" ]]; then
1717 aarch64|arm64) arch=linux-arm64 ;;
1818 * ) echo >&2 " unsupported architecture: $arch " ; exit 1 ;;
1919 esac
20- say " Fetching the latest runner version..."
20+
21+ say " Getting the latest runner version (previously updated at $( cat $updated_at_file ) )..."
2122 runner_version=$( curl --silent " https://api.github.com/repos/actions/runner/releases/latest" | jq -r " .tag_name[1:]" )
22- say " Updating runner to \" $runner_version \" (previously updated on $( cat $updated_at_file ) )..."
23- curl --no-progress-meter -L " https://github.com/actions/runner/releases/download/v$runner_version /actions-runner-$arch -$runner_version .tar.gz" | tar xz
24- say " Updated runner to $runner_version (previously updated on $( cat $updated_at_file ) )."
25- date > $updated_at_file
23+
24+ file=" actions-runner-$arch -$runner_version .tar.gz"
25+ path=" $CACHE_DIR /$file "
26+ url=" https://github.com/actions/runner/releases/download/v$runner_version /$file "
27+
28+ say " Content of $CACHE_DIR :"
29+ ls -la " $CACHE_DIR "
30+
31+ if [[ ! -r " $path " ]]; then
32+ say " Downloading $url to $CACHE_DIR ..."
33+ curl --no-progress-meter -L " $url " > " $path .tmp"
34+ mv -f " $path .tmp" " $path "
35+ else
36+ say " Using previously downloaded $path "
37+ fi
38+
39+ tar xzf " $path "
40+ date > " $updated_at_file "
41+
42+ say " Updated runner to $runner_version from $path "
2643else
27- say " Runner is new enough (last updated on $( cat $updated_at_file ) ), skipping the update."
44+ say " Runner is new enough (previously updated at $( cat $updated_at_file ) ), skipping the update."
2845fi
0 commit comments