Github For Ubuntu Upd
The GitHub CLI is the most common tool for interacting with GitHub from the terminal.
Create .github/workflows/upd-automation.yml:
name: Remote Ubuntu UPD Automationon: schedule: - cron: '0 2 * * 3' # Every Wednesday at 2 AM workflow_dispatch: # Allow manual trigger
jobs: run-upd: runs-on: ubuntu-latest steps: - name: Checkout UPD script from repo uses: actions/checkout@v4 github for ubuntu upd
- name: Run UPD script on remote Ubuntu uses: appleboy/ssh-action@v1.0.0 with: host: $ secrets.UBUNTU_HOST username: $ secrets.UBUNTU_USER key: $ secrets.SSH_PRIVATE_KEY script: | cd /tmp git clone https://github.com/your-username/ubuntu-upd-scripts.git cd ubuntu-upd-scripts/scripts chmod +x upd-core.sh sudo ./upd-core.sh
Now, your Ubuntu server will be updated automatically every Wednesday at 2 AM – all orchestrated from GitHub. The GitHub CLI is the most common tool
Run this on each Ubuntu machine to check updates and report to GitHub.
#!/bin/bash
# ubuntu-upd-client.sh
# Reports pending updates to GitHub Issue or PR
REPO="your-org/ubuntu-updates"
GITHUB_TOKEN="your_personal_access_token"
MACHINE_ID=$(hostname)
If you don’t want to trust third-party code, create your own update command using GitHub gists or your private repo: Now, your Ubuntu server will be updated automatically
# Add to ~/.bashrc or ~/.zshrc
alias github-update='cd ~/my-updater && git pull && ./update.sh'
Then store your personal update.sh script on GitHub. This gives you version control + easy updates.
From Ubuntu repos:
sudo apt update
sudo apt upgrade -y
For newer Git than distro provides:
sudo add-apt-repository ppa:git-core/ppa
sudo apt update
sudo apt install -y git
sudo apt install -y make libssl-dev libghc-zlib-dev libcurl4-gnutls-dev libexpat1-dev gettext
wget https://www.kernel.org/pub/software/scm/git/git-<version>.tar.gz
tar -xf git-<version>.tar.gz
cd git-<version>
make prefix=/usr/local all
sudo make prefix=/usr/local install
For gh: use the official apt source (installation steps above) or update via package manager:
sudo apt update
sudo apt install --only-upgrade gh
Or install via snap:
sudo snap install gh --classic
sudo snap refresh gh
