2626 echo "Checking age version..."
2727 age --version
2828
29+ - name : Install or Update GitHub CLI (gh)
30+ run : |
31+ echo "Checking for latest gh release..."
32+ ARCH=$(uname -m)
33+ if [ "$ARCH" = "aarch64" ]; then GH_ARCH="arm64"; elif [[ "$ARCH" == armv* ]]; then GH_ARCH="armv6"; else GH_ARCH="amd64"; fi
34+ GH_VERSION=$(curl -sH "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/cli/cli/releases/latest" | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/')
35+
36+ INSTALL_GH=false
37+ if ! command -v gh &> /dev/null; then
38+ echo "gh not found. Will install version $GH_VERSION"
39+ INSTALL_GH=true
40+ else
41+ CURRENT_VERSION=$(gh --version | head -n 1 | awk '{print $3}')
42+ if [ "$CURRENT_VERSION" != "$GH_VERSION" ]; then
43+ echo "gh version mismatch (current: $CURRENT_VERSION, latest: $GH_VERSION). Updating..."
44+ INSTALL_GH=true
45+ else
46+ echo "gh is up-to-date (version $CURRENT_VERSION)."
47+ fi
48+ fi
49+
50+ if [ "$INSTALL_GH" = true ]; then
51+ echo "Downloading gh version $GH_VERSION for $GH_ARCH..."
52+ curl -sL "https://github.com/cli/cli/releases/download/v${GH_VERSION}/gh_${GH_VERSION}_linux_${GH_ARCH}.tar.gz" -o gh.tar.gz
53+ tar xzf gh.tar.gz
54+ # Install globally so it's persistent and usable by all workflows
55+ sudo cp "gh_${GH_VERSION}_linux_${GH_ARCH}/bin/gh" "/usr/local/bin/"
56+ echo "Installation complete."
57+ fi
58+
2959 - name : Decrypt secrets.sops.env to .env file on Pi
3060 env :
3161 SOPS_AGE_KEY : ${{ secrets.RUNNER_AGE_PRIVATE_KEY }}
@@ -37,12 +67,12 @@ jobs:
3767 sudo -E chmod 600 "${TARGET_ENV_FILE}"
3868 echo ".env file created at ${TARGET_ENV_FILE} with restricted permissions."
3969
40- - name : Check for Tailscale and Install if Missing
70+ - name : Install or Update Tailscale
4171 run : |
42- # This step is already quiet, no changes needed.
4372 if command -v tailscale &> /dev/null
4473 then
45- echo "Tailscale is already installed. Skipping installation."
74+ echo "Tailscale is already installed. Attempting update..."
75+ sudo tailscale update --yes || echo "Tailscale update failed or unsupported via this method, continuing..."
4676 else
4777 echo "Tailscale not found. Installing..."
4878 curl -fsSL https://tailscale.com/install.sh | sudo sh
0 commit comments