stages: - checks - commit packages-build: stage: checks image: archlinux:latest script: - pacman -Sy --noconfirm base-devel fakeroot >/dev/null - useradd foo && chown -R foo * - su foo -c "./build-packages check" update-repository: stage: commit image: archlinux:latest before_script: - pacman -Sy --noconfirm git base-devel fakeroot script: - git config --global user.email "bot@tipragot.fr" - git config --global user.name "TipraBot" - useradd foo && chown -R foo * - | if su foo -c "./build-packages"; then git add repository updated_packages=$(git status --short | grep -e "A repository/.*.zst" | cut -d '/' -f 2 | sed 's;-[0-9].*.zst;;' | sed 's;^;- ;') git commit -m "Update repository" -m "$(echo -e "Updated packages:\n${updated_packages}")" git remote set-url --push origin "https://$TOKEN_NAME:$ACCESS_TOKEN@git.tipragot.fr/${CI_PROJECT_PATH}.git" git push origin HEAD:main fi only: - main