default: tags: - medium image: archlinux:latest stages: - build - post build: stage: build variables: GIT_SUBMODULE_STRATEGY: recursive artifacts: untracked: true expire_in: 4 hours only: changes: - .gitlab-ci.yml - pkgbuild.sh - repo/**/* script: - echo -e '\n[archlinuxcn]\nServer = https://repo.archlinuxcn.org/$arch\n' >> /etc/pacman.conf - pacman-key --init # import myself key first - curl -fL https://keys.openpgp.org/vks/v1/by-fingerprint/4A0F0C8BC709ACA4341767FB243975C8DB9656B9 | pacman-key --add - - pacman-key --finger 4A0F0C8BC709ACA4341767FB243975C8DB9656B9 - pacman-key --lsign-key 4A0F0C8BC709ACA4341767FB243975C8DB9656B9 - pacman --noconfirm --needed -Sy archlinuxcn-keyring - pacman --noconfirm --needed -Su base-devel gnupg git yay - useradd -m build - echo 'build ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers #- cp -r ../$CI_PROJECT_TITLE /home/build/ #- cd /home/build/$CI_PROJECT_TITLE - chown -R build:build ../$CI_PROJECT_TITLE - su -c 'echo $GPG_PRIV_KEY | base64 -d | gpg --import' build - su -c './pkgbuild.sh' build - rm -rf build/ # only push to master master trigger push post: stage: post rules: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH changes: - .gitlab-ci.yml - pkgbuild.sh - repo/**/* - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_TITLE =~ /REBUILD/ script: - if [ -n "$TARGET_HOSTS" ]; then echo "$TARGET_HOSTS" | base64 -d >> /etc/hosts; fi; - bash -c './ci-upload.sh'