mirror of
https://github.com/built-aur/packages
synced 2024-08-14 23:01:15 +00:00
update
This commit is contained in:
parent
9f6d8c4f51
commit
1464704820
5 changed files with 146 additions and 1 deletions
21
.github/workflows/package-updates.yml
vendored
21
.github/workflows/package-updates.yml
vendored
|
@ -16,7 +16,7 @@ jobs:
|
|||
- name: work around permission issue
|
||||
run: git config --global --add safe.directory /__w/packages/packages
|
||||
|
||||
- name: Clone repository
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
@ -43,3 +43,22 @@ jobs:
|
|||
GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GIT_COMMIT_PACKAGES: true
|
||||
GIT_PUSH_PACKAGES: true
|
||||
|
||||
push-aur:
|
||||
if: github.repository == 'built-aur/packages'
|
||||
runs-on: ubuntu-latest
|
||||
container: ghcr.io/built-aur/packages:latest
|
||||
|
||||
steps:
|
||||
- name: work around permission issue
|
||||
run: git config --global --add safe.directory /__w/packages/packages
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Push to AUR
|
||||
run: ./scripts/push-aur-entrypoint.sh
|
||||
env:
|
||||
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||
COMMIT_USER: "MedzikUserBot"
|
||||
COMMIT_EMAIL: "rm99iv9s@duck.com"
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
FROM medzik/archlinux:latest
|
||||
|
||||
COPY ssh_config /ssh_config
|
||||
COPY makepkg.x86-64.conf /etc/makepkg.x86-64.conf
|
||||
COPY makepkg.x86-64-v3.conf /etc/makepkg.x86-64-v3.conf
|
||||
|
||||
|
|
3
scripts/docker/ssh_config
Normal file
3
scripts/docker/ssh_config
Normal file
|
@ -0,0 +1,3 @@
|
|||
Host aur.archlinux.org
|
||||
IdentityFile ~/.ssh/aur
|
||||
User aur
|
13
scripts/push-aur-entrypoint.sh
Executable file
13
scripts/push-aur-entrypoint.sh
Executable file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -o errexit -o pipefail -o nounset
|
||||
|
||||
echo '::group::Initializing SSH directory'
|
||||
mkdir -pv /home/build/.ssh
|
||||
touch /home/build/.ssh/known_hosts
|
||||
cp -v /ssh_config /home/build/.ssh/config
|
||||
chown -vR build:build /home/build
|
||||
chmod -vR 600 /home/build/.ssh/*
|
||||
echo '::endgroup::'
|
||||
|
||||
exec su -c 'bash -c ./scripts/publish-aur.sh' build
|
109
scripts/push-aur.sh
Executable file
109
scripts/push-aur.sh
Executable file
|
@ -0,0 +1,109 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -o errexit -o pipefail -o nounset
|
||||
|
||||
# Commit changes to Git.
|
||||
: "${GIT_COMMIT_PACKAGES:=false}"
|
||||
# Push changes to remote.
|
||||
: "${GIT_PUSH_PACKAGES:=false}"
|
||||
|
||||
SCRIPT_DIR="$(realpath "$(dirname "$0")")"
|
||||
SRC_DIR="$(realpath "$(dirname "${SCRIPT_DIR}")")"
|
||||
TMP_DIR="$(mktemp -d -t medzik-aur-XXXX)"
|
||||
|
||||
mkdir "${TMP_DIR}/aur"
|
||||
|
||||
source "${SCRIPT_DIR}/lib/parse-conf.sh"
|
||||
|
||||
echo '::group::Adding aur.archlinux.org to known hosts'
|
||||
ssh-keyscan -v -t "rsa,dsa,ecdsa,ed25519" aur.archlinux.org >>~/.ssh/known_hosts
|
||||
echo '::endgroup::'
|
||||
|
||||
echo '::group::Importing private key'
|
||||
echo "${SSH_PRIVATE_KEY}" >~/.ssh/aur
|
||||
chmod -vR 600 ~/.ssh/aur*
|
||||
ssh-keygen -vy -f ~/.ssh/aur >~/.ssh/aur.pub
|
||||
echo '::endgroup::'
|
||||
|
||||
echo '::group::Checksums of SSH keys'
|
||||
sha512sum ~/.ssh/aur ~/.ssh/aur.pub
|
||||
echo '::endgroup::'
|
||||
|
||||
echo '::group::Configuring Git'
|
||||
git config --global user.name "${COMMIT_USER}"
|
||||
git config --global user.email "${COMMIT_EMAIL}"
|
||||
echo '::endgroup::'
|
||||
|
||||
push() {
|
||||
local pkgdir="${1}"
|
||||
local pkgname="$(basename ${pkgdir})"
|
||||
|
||||
if [ ! -f "${pkgdir}/built.conf" ]
|
||||
then
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ ! -f "${pkgdir}/PKGBUILD" ]
|
||||
then
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ -f "${pkgdir}/built.conf" ]
|
||||
then
|
||||
eval "$(parse-conf ${pkgdir})"
|
||||
|
||||
cd "${SRC_DIR}"
|
||||
|
||||
if [ -n "${AUR_PUSH}" ]
|
||||
then
|
||||
echo '::group::Cloning AUR package into /tmp/local-repo'
|
||||
git clone -v "https://aur.archlinux.org/${pkgname}.git" /tmp/local-repo
|
||||
echo '::endgroup::'
|
||||
|
||||
echo '::group::Copying files into /tmp/local-repo'
|
||||
cp -r "${pkgdir}"/* /tmp/local-repo/
|
||||
rm -rf /tmp/local-repo//build.yml
|
||||
echo '::endgroup::'
|
||||
|
||||
echo '::group::Generating .SRCINFO'
|
||||
cd /tmp/local-repo
|
||||
makepkg --printsrcinfo >.SRCINFO
|
||||
echo '::endgroup::'
|
||||
|
||||
echo '::group::Committing files to the repository'
|
||||
git add /tmp/local-repo
|
||||
git commit -m "sync with built-aur"
|
||||
echo '::endgroup::'
|
||||
|
||||
echo '::group::Push package to AUR'
|
||||
git push -v origin master
|
||||
echo '::endgroup::'
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
if [ -n "${1}" ]
|
||||
then
|
||||
update-package "./packages/${1}"
|
||||
update-package "./long-built/${1}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
for pkgdir in ./packages/* ./long-built/*
|
||||
do
|
||||
push "${pkgdir}"
|
||||
|
||||
EXIT_CODE="${?}"
|
||||
|
||||
if ! (( ${EXIT_CODE} ))
|
||||
then
|
||||
if [ "${GIT_PUSH_PACKAGES}" = "true" ]
|
||||
then
|
||||
git pull --rebase &> /dev/null
|
||||
git push &> /dev/null
|
||||
fi
|
||||
else
|
||||
echo "[!] Failed to update package '$(basename ${pkgdir})'"
|
||||
fi
|
||||
done
|
Loading…
Reference in a new issue