2023-03-25 12:25:57 +00:00
|
|
|
name: 'Mirror'
|
|
|
|
description: 'Test and Mirror AUR Packages'
|
|
|
|
|
|
|
|
inputs:
|
|
|
|
pkgbase:
|
|
|
|
description: 'The pkgbase from the AUR.'
|
|
|
|
required: false
|
|
|
|
ssh_key:
|
|
|
|
description: 'The base64-part of the private key to upload to the AUR.'
|
|
|
|
required: true
|
|
|
|
|
|
|
|
runs:
|
|
|
|
using: "composite"
|
|
|
|
steps:
|
2023-03-25 12:35:11 +00:00
|
|
|
|
2023-03-25 12:25:57 +00:00
|
|
|
- name: Test AUR package
|
|
|
|
uses: docker://docker.io/library/archlinux:base-devel
|
|
|
|
with:
|
2023-03-25 12:39:10 +00:00
|
|
|
entrypoint: bash
|
2023-03-25 12:40:12 +00:00
|
|
|
args: |
|
2023-03-25 12:51:03 +00:00
|
|
|
-euo pipefail -c '
|
|
|
|
pacman -Syu --noconfirm git
|
2023-03-25 12:53:10 +00:00
|
|
|
|
2023-03-25 12:51:03 +00:00
|
|
|
useradd -m user
|
|
|
|
echo "user ALL=(ALL:ALL) NOPASSWD: ALL" >/etc/sudoers.d/user
|
2023-03-25 12:53:10 +00:00
|
|
|
|
|
|
|
sudo -u user -- bash -c "cd ~ && git clone https://aur.archlinux.org/yay.git && cd yay && makepkg -si --noconfirm"
|
|
|
|
|
2023-03-25 12:51:03 +00:00
|
|
|
chmod 777 .
|
|
|
|
sudo -u user -- PACMAN=yay makepkg -s --noconfirm
|
|
|
|
'
|
2023-03-25 12:25:57 +00:00
|
|
|
|
|
|
|
- name: Ensure .SRCINFO is up to date
|
|
|
|
uses: docker://docker.io/library/archlinux:base-devel
|
|
|
|
with:
|
|
|
|
entrypoint: bash
|
|
|
|
args: -c 'makepkg --printsrcinfo >>.SRCINFO.new && diff -u .SRCINFO{,.new}'
|
|
|
|
|
|
|
|
- name: Mirror to the AUR
|
|
|
|
run: |
|
|
|
|
printf '%s' '${{inputs.ssh_key}}' >ssh_key
|
|
|
|
echo 'aur.archlinux.org ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEuBKrPzbawxA/k2g6NcyV5jmqwJ2s+zpgZGZ7tpLIcN' >>~/.ssh/known_hosts
|
|
|
|
|
|
|
|
pkgbase='${{inputs.pkgbase}}'
|
|
|
|
[ -n "$pkgbase" ] || pkgbase="$( (. PKGBUILD && printf '%s' "$pkgbase") )"
|
|
|
|
[ -n "$pkgbase" ] || pkgbase="$( (. PKGBUILD && printf '%s' "$pkgname") )"
|
|
|
|
|
|
|
|
[ -n "$pkgbase" ] || \
|
|
|
|
( echo "Failed to determine pkgbase"; exit 1 )
|
|
|
|
[ "${{github.ref_name}}" == "main" ] || [ "${{github.ref_name}}" == "master" ] || \
|
|
|
|
( echo "Git ref is neither main nor master, aborting"; exit 1 ) || exit 0
|
|
|
|
|
|
|
|
export GIT_SSH_COMMAND='ssh -i ssh_key -o IdentitiesOnly=yes'
|
|
|
|
git remote add aur "ssh://aur@aur.archlinux.org/$pkgbase.git"
|
|
|
|
git push aur "${{github.ref_name}}:master"
|