first commit

This commit is contained in:
2025-08-11 11:10:09 +07:00
commit 463b052a3a
2 changed files with 89 additions and 0 deletions

40
README.md Normal file
View File

@@ -0,0 +1,40 @@
## Act Runner Installer
Simple installer to fetch and install the latest `gitea/act_runner` release for your Linux machine.
### Quick start
Run the installer directly:
```bash
curl -fSSL https://<url>/install.sh | bash
```
If your environment requires elevated permissions to write to `/usr/local/bin`, run with sudo:
```bash
curl -fSSL https://<url>/install.sh | sudo bash
```
### What it does
- Detects your CPU architecture
- Fetches the latest `act_runner` release info
- Downloads the appropriate Linux binary
- Installs it to `/usr/local/bin/act_runner` and makes it executable
### Requirements
- Linux
- `curl`, `jq`, `wget`, `unxz`, `sha256sum`
### Notes
- The script will update an existing installation if a newer version is available.
- You may need network access to `gitea.com` to retrieve release metadata.
### Uninstall
```bash
sudo rm -f /usr/local/bin/act_runner
```

49
install.sh Normal file
View File

@@ -0,0 +1,49 @@
#!/bin/bash
check_command() {
command -v $1 >/dev/null 2>&1
}
check_version() {
act_runner_version=$(act_runner -v | grep -o 'v[0-9]\+\.[0-9]\+\.[0-9]\+')
echo $act_runner_version
}
if check_command act_runner; then
current_version=$(check_version)
echo "Current act_runner version: $current_version"
fi
required_commands=("curl" "jq" "wget" "unxz" "sha256sum")
for cmd in "${required_commands[@]}"; do
if ! check_command $cmd; then
echo "Error: '$cmd' command not found. Please make sure all required commands are installed."
exit 1
fi
done
arch=$(uname -m)
if [ "$arch" = "x86_64" ]; then
arch="amd64"
fi
json=$(curl -s https://gitea.com/api/v1/repos/gitea/act_runner/releases/latest)
latest_version=$(echo $json | jq -r '.tag_name')
url_checksum=$(echo $json | jq -r '.assets[] | select(.name | contains("linux-'$arch'") and contains(".xz.sha256")) | .browser_download_url')
url_binary=$(echo $json | jq -r '.assets[] | select(.name | contains("linux-'$arch'") and contains(".xz")) | .browser_download_url')
checksum_filename=$(basename $url_checksum)
filename=$(basename $url_binary)
if [ -z "$current_version" ] || [ "$current_version" != "$latest_version" ]; then
echo "Updating act_runner to version: $latest_version"
wget $url_binary
sha256sum -c $checksum_filename
rm $checksum_filename
unxz $filename
filename=$(echo $filename | sed 's/\.xz$//')
mv $filename '/usr/local/bin/act_runner'
chmod +x /usr/local/bin/act_runner
echo "Update completed."
else
echo "act_runner is up to date."
fi