Skip to content

Commit 1826a6c

Browse files
committed
Add runner update script and documentation
- Automated script to update self-hosted runner - Documentation for manual and automated update methods - Required for actions/checkout@v6 (needs runner v2.329.0+)
1 parent b82a7fe commit 1826a6c

2 files changed

Lines changed: 209 additions & 0 deletions

File tree

‎docs/UPDATE_RUNNER.md‎

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# Updating Self-Hosted GitHub Actions Runner
2+
3+
## Why Update?
4+
5+
The repository now uses `actions/checkout@v6.0.1` which requires **Actions Runner v2.329.0 or newer**.
6+
7+
## Check Current Version
8+
9+
Run the next CI workflow - it will show the current runner version in the logs under "Check Actions Runner version".
10+
11+
Or SSH to your runner machine and run:
12+
```bash
13+
/home/cnc/actions-runner/bin/Runner.Listener --version
14+
```
15+
16+
## Update Methods
17+
18+
### Method 1: Automated Script (Recommended)
19+
20+
1. Copy `update_runner.sh` to your runner machine:
21+
```bash
22+
scp update_runner.sh cnc@<runner-ip>:/home/cnc/
23+
```
24+
25+
2. SSH to the runner:
26+
```bash
27+
ssh cnc@<runner-ip>
28+
```
29+
30+
3. Run the update script:
31+
```bash
32+
chmod +x update_runner.sh
33+
./update_runner.sh
34+
```
35+
36+
The script will:
37+
- Show current and latest versions
38+
- Stop the runner service
39+
- Download and extract the latest runner
40+
- Restart the service
41+
42+
### Method 2: Manual Update
43+
44+
1. SSH to your runner machine:
45+
```bash
46+
ssh cnc@<runner-ip>
47+
```
48+
49+
2. Stop the runner service:
50+
```bash
51+
cd /home/cnc/actions-runner
52+
sudo ./svc.sh stop
53+
```
54+
55+
3. Download the latest runner (check https://github.com/actions/runner/releases for latest version):
56+
```bash
57+
# For x64 architecture:
58+
curl -o actions-runner-linux-x64-2.321.0.tar.gz -L \
59+
https://github.com/actions/runner/releases/download/v2.321.0/actions-runner-linux-x64-2.321.0.tar.gz
60+
61+
# For ARM64 architecture (Raspberry Pi):
62+
curl -o actions-runner-linux-arm64-2.321.0.tar.gz -L \
63+
https://github.com/actions/runner/releases/download/v2.321.0/actions-runner-linux-arm64-2.321.0.tar.gz
64+
```
65+
66+
4. Extract the new version:
67+
```bash
68+
tar xzf actions-runner-linux-*.tar.gz
69+
```
70+
71+
5. Fix permissions:
72+
```bash
73+
sudo chown -R cnc:cnc /home/cnc/actions-runner
74+
```
75+
76+
6. Start the runner service:
77+
```bash
78+
sudo ./svc.sh start
79+
```
80+
81+
7. Verify the update:
82+
```bash
83+
./bin/Runner.Listener --version
84+
sudo ./svc.sh status
85+
```
86+
87+
## Fallback Option
88+
89+
If you can't update the runner immediately, you can temporarily use `actions/checkout@v4.3.1` instead:
90+
91+
In `.github/workflows/ci.yml`, change:
92+
```yaml
93+
uses: actions/checkout@v6.0.1
94+
```
95+
to:
96+
```yaml
97+
uses: actions/checkout@v4.3.1
98+
```
99+
100+
## Troubleshooting
101+
102+
### Runner won't start after update
103+
```bash
104+
cd /home/cnc/actions-runner
105+
sudo ./svc.sh uninstall
106+
sudo ./svc.sh install
107+
sudo ./svc.sh start
108+
```
109+
110+
### Permission errors
111+
```bash
112+
sudo chown -R cnc:cnc /home/cnc/actions-runner
113+
sudo chmod -R u+rwx /home/cnc/actions-runner
114+
```
115+
116+
### Check runner logs
117+
```bash
118+
journalctl -u actions.runner.* -f
119+
```
120+
121+
## Post-Update
122+
123+
After updating, trigger a new CI run by pushing a commit to verify everything works correctly.

‎update_runner.sh‎

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
#!/bin/bash
2+
3+
# GitHub Actions Runner Update Script
4+
# This script updates the self-hosted runner to the latest version
5+
6+
set -e
7+
8+
echo "=== GitHub Actions Runner Update Script ==="
9+
echo ""
10+
11+
# Configuration
12+
RUNNER_DIR="/home/cnc/actions-runner"
13+
RUNNER_USER="cnc"
14+
15+
# Check current version
16+
echo "Current runner version:"
17+
if [ -f "$RUNNER_DIR/bin/Runner.Listener" ]; then
18+
CURRENT_VERSION=$($RUNNER_DIR/bin/Runner.Listener --version 2>/dev/null || echo "unknown")
19+
echo " $CURRENT_VERSION"
20+
else
21+
echo " Runner not found at $RUNNER_DIR"
22+
exit 1
23+
fi
24+
25+
echo ""
26+
echo "Required minimum version for checkout@v6: v2.329.0"
27+
echo ""
28+
29+
# Get latest runner version
30+
echo "Fetching latest runner version from GitHub..."
31+
LATEST_VERSION=$(curl -s https://api.github.com/repos/actions/runner/releases/latest | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/')
32+
echo "Latest available version: v$LATEST_VERSION"
33+
echo ""
34+
35+
# Ask for confirmation
36+
read -p "Do you want to update the runner? (y/n): " -n 1 -r
37+
echo ""
38+
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
39+
echo "Update cancelled."
40+
exit 0
41+
fi
42+
43+
echo ""
44+
echo "=== Starting Runner Update ==="
45+
echo ""
46+
47+
# Stop the runner service
48+
echo "Stopping runner service..."
49+
cd "$RUNNER_DIR"
50+
sudo ./svc.sh stop || true
51+
52+
# Download the latest runner
53+
echo "Downloading runner v$LATEST_VERSION..."
54+
RUNNER_ARCH="x64" # Change to arm64 if running on ARM
55+
RUNNER_FILE="actions-runner-linux-${RUNNER_ARCH}-${LATEST_VERSION}.tar.gz"
56+
DOWNLOAD_URL="https://github.com/actions/runner/releases/download/v${LATEST_VERSION}/${RUNNER_FILE}"
57+
58+
curl -o "${RUNNER_FILE}" -L "${DOWNLOAD_URL}"
59+
60+
# Extract the new version
61+
echo "Extracting runner..."
62+
tar xzf "${RUNNER_FILE}"
63+
64+
# Clean up
65+
rm "${RUNNER_FILE}"
66+
67+
# Fix permissions
68+
echo "Fixing permissions..."
69+
sudo chown -R ${RUNNER_USER}:${RUNNER_USER} "$RUNNER_DIR"
70+
71+
# Start the runner service
72+
echo "Starting runner service..."
73+
sudo ./svc.sh start
74+
75+
echo ""
76+
echo "=== Update Complete ==="
77+
echo ""
78+
echo "New runner version:"
79+
$RUNNER_DIR/bin/Runner.Listener --version
80+
81+
echo ""
82+
echo "Runner service status:"
83+
sudo ./svc.sh status
84+
85+
echo ""
86+
echo "Update completed successfully!"

0 commit comments

Comments
 (0)