Skip to content

Commit fdceb88

Browse files
Copilotgensyn
andcommitted
Add docker and act auto-update to run_workflows_locally.sh
Agent-Logs-Url: https://github.com/gensyn/ssh_command/sessions/e96ed70c-aee3-48c8-8b35-0fd8cb359f87 Co-authored-by: gensyn <36128035+gensyn@users.noreply.github.com>
1 parent a1f26db commit fdceb88

1 file changed

Lines changed: 35 additions & 4 deletions

File tree

run_workflows_locally.sh

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,23 @@ header() { echo -e "\n${BOLD}$*${NC}"; }
3030

3131
command_exists() { command -v "$1" &>/dev/null; }
3232

33-
# ── Docker installation ───────────────────────────────────────────────────────
33+
# ── Docker installation / update ─────────────────────────────────────────────
3434
install_docker() {
3535
if command_exists docker; then
36-
info "Docker is already installed: $(sudo docker --version)"
36+
info "Checking for Docker updates…"
37+
if command_exists apt-get; then
38+
sudo apt-get update -qq \
39+
&& sudo apt-get install --only-upgrade -y \
40+
docker-ce docker-ce-cli containerd.io docker-compose-plugin \
41+
|| true
42+
elif command_exists yum; then
43+
sudo yum update -y \
44+
docker-ce docker-ce-cli containerd.io docker-compose-plugin \
45+
|| true
46+
else
47+
warn "Cannot automatically update Docker on this platform; please update it manually."
48+
fi
49+
info "Docker version after update check: $(sudo docker --version)"
3750
return 0
3851
fi
3952

@@ -43,10 +56,28 @@ install_docker() {
4356
warn "Docker installed. You may need to run 'newgrp docker' or re-login for group membership to take effect."
4457
}
4558

46-
# ── act installation ──────────────────────────────────────────────────────────
59+
# ── act installation / update ─────────────────────────────────────────────────
4760
install_act() {
4861
if command_exists act; then
49-
info "act is already installed: $(act --version)"
62+
local current_version latest_version
63+
current_version="$(act --version 2>/dev/null | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1 || true)"
64+
latest_version="$(curl -fsSL https://api.github.com/repos/nektos/act/releases/latest 2>/dev/null \
65+
| grep '"tag_name"' | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1 || true)"
66+
67+
if [[ -z "$current_version" ]] || [[ -z "$latest_version" ]]; then
68+
warn "Could not determine act versions; skipping update check."
69+
info "act is already installed: $(act --version)"
70+
return 0
71+
fi
72+
73+
if [[ "$current_version" == "$latest_version" ]]; then
74+
info "act is already up to date: $(act --version)"
75+
return 0
76+
fi
77+
78+
header "Updating act from ${current_version} to ${latest_version}"
79+
curl -fsSL https://raw.githubusercontent.com/nektos/act/master/install.sh \
80+
| sudo bash -s -- -b /usr/local/bin
5081
return 0
5182
fi
5283

0 commit comments

Comments
 (0)