Update AUR Package #26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Update AUR Package | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| jobs: | |
| update-aur: | |
| runs-on: ubuntu-latest | |
| container: archlinux:latest | |
| steps: | |
| - name: Install dependencies | |
| run: | | |
| # Disable pacman sandbox to avoid seccomp issues in containers | |
| sed -i 's/^#\?DisableSandboxSyscalls.*/DisableSandboxSyscalls/' /etc/pacman.conf | |
| pacman -Syu --noconfirm git openssh curl base-devel | |
| - name: Checkout main repo | |
| uses: actions/checkout@v4 | |
| - name: Get version from pyproject.toml | |
| id: get_version | |
| run: | | |
| VERSION=$(grep '^version =' pyproject.toml | sed 's/version = "\(.*\)"/\1/') | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Update PKGBUILD and generate .SRCINFO | |
| run: | | |
| VERSION=${{ steps.get_version.outputs.version }} | |
| cd .github/aur | |
| SOURCE_URL="https://github.com/Matars/gitfetch/archive/refs/tags/v${VERSION}.tar.gz" | |
| SHA256=$(curl -sL "$SOURCE_URL" | sha256sum | awk '{print $1}') | |
| sed -i "s/^pkgver=.*/pkgver=$VERSION/" PKGBUILD | |
| sed -i "s/^pkgrel=.*/pkgrel=1/" PKGBUILD | |
| sed -i "s/^sha256sums=.*/sha256sums=('$SHA256')/" PKGBUILD | |
| # makepkg cannot run as root, create a builder user | |
| useradd -m builder | |
| chown -R builder: . | |
| su builder -c "makepkg --printsrcinfo > .SRCINFO" | |
| - name: Setup SSH for AUR | |
| run: | | |
| mkdir -p ~/.ssh | |
| echo "${{ secrets.AUR_SSH_KEY }}" > ~/.ssh/aur_key | |
| chmod 600 ~/.ssh/aur_key | |
| printf 'Host aur.archlinux.org\n IdentityFile ~/.ssh/aur_key\n User aur\n' > ~/.ssh/config | |
| chmod 600 ~/.ssh/config | |
| ssh-keyscan aur.archlinux.org >> ~/.ssh/known_hosts | |
| - name: Clone and update AUR | |
| run: | | |
| git clone ssh://aur@aur.archlinux.org/gitfetch-python.git aur-repo | |
| cp .github/aur/PKGBUILD aur-repo/ | |
| cp .github/aur/.SRCINFO aur-repo/ | |
| cd aur-repo | |
| git config user.name "Matar" | |
| git config user.email "khaledmatar19733@gmail.com" | |
| git add PKGBUILD .SRCINFO | |
| git commit -m "Update gitfetch-python to v${{ steps.get_version.outputs.version }}" || echo "No changes to commit" | |
| git push |