Skip to content

Update AUR

Update AUR #148

Workflow file for this run

name: Update AUR
on:
pull_request:
schedule:
- cron: '0 */6 * * *' # at minute 0, every 6th hour
workflow_dispatch:
permissions:
contents: write
jobs:
update-aur:
runs-on: ubuntu-latest
steps:
- name: Checkout GitHub repository
uses: actions/checkout@v4
- name: Set up Git
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
- name: Install Cloudfleet CLI from APT
env:
NONINTERACTIVE: 1
run: |
curl -fsSL https://downloads.cloudfleet.ai/apt/pubkey.gpg | sudo tee /usr/share/keyrings/cloudfleet-archive-keyring.gpg >/dev/null
echo "deb [signed-by=/usr/share/keyrings/cloudfleet-archive-keyring.gpg] https://downloads.cloudfleet.ai/apt stable main" | sudo tee /etc/apt/sources.list.d/cloudfleet.list
sudo apt-get update
sudo apt-get install -y cloudfleet
- name: Get Cloudfleet version
id: cloudfleet
run: |
VERSION=$(cloudfleet --version | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
echo "Latest version is $VERSION"
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Get UID/GID
id: ids
run: |
echo "uid=$(id -u)" >> $GITHUB_OUTPUT
echo "gid=$(id -g)" >> $GITHUB_OUTPUT
- name: Update PKGBUILD and .SRCINFO
id: update
uses: addnab/docker-run-action@v3
env:
VERSION: ${{ env.VERSION }}
with:
image: archlinux:latest
options: --rm -e VERSION=${{ env.VERSION }} -v ${{ github.workspace }}:/src -u ${{ steps.ids.outputs.uid }}:${{ steps.ids.outputs.gid }}
run: |
# Install makepkg deps
pacman -Sy --noconfirm base-devel git
# Run the update script
cd /src && ./update.sh
- name: Set up SSH key
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master'
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
- name: Set up AUR SSH
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master'
run: |
mkdir -p ~/.ssh
ssh-keyscan aur.archlinux.org >> ~/.ssh/known_hosts
- name: Prepare minimal AUR repo
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master'
run: |
rm -rf aur-repo
git clone --branch master "ssh://[email protected]/cloudfleet-cli.git" aur-repo
cd aur-repo
cp ../PKGBUILD ../.SRCINFO ../README.md ./
git add -A
# Check if any changes exist
if git diff-index --quiet HEAD; then
echo "No changes detected. Skipping push."
exit 0 # Still success
else
git commit -m "Auto-update to $VERSION"
git push origin master
fi
- name: Configure GitHub push authentication
if: success() && github.event_name != 'pull_request' && github.ref == 'refs/heads/master'
run: |
git remote set-url origin "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git"
- name: Push changes to GitHub
if: success() && github.event_name != 'pull_request' && github.ref == 'refs/heads/master'
run: |
git add PKGBUILD .SRCINFO
if git diff-index --quiet HEAD; then
echo "No changes detected. Skipping GitHub commit."
else
git commit -m "Auto-update to $VERSION"
git push origin master
fi
- name: Success
if: success() && github.event_name != 'pull_request' && github.ref == 'refs/heads/master'
run: echo "AUR repository updated or already up-to-date!"