summarylogtreecommitdiffstats
path: root/.gitlab-ci.yml
blob: b88336980ccf34b447440ce7dc928502f643aeca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
stages:
  - test
  - build
  - install_before
  - deploy
  - install_after

namcap:
  stage: test
  image: docker.io/archlinux:latest
  before_script:
    - pacman -Syu --noconfirm namcap
  script:
    - namcap PKGBUILD

makepkg:
  stage: build
  image: docker.io/archlinux:base-devel
  before_script:
    - pacman -Syu --noconfirm sudo git
    - useradd builduser -m && passwd -d builduser
    - printf 'builduser ALL=(ALL) ALL\n' | tee -a /etc/sudoers
    - sudo -u builduser bash -c 'git clone "https://aur.archlinux.org/yay.git"'
    - sudo -u builduser bash -c 'cd yay && makepkg -si --noconfirm'
    - rm -rf yay && cp $(which yay) yay
  script:
    - sudo -u builduser bash -c 'makepkg -s --noconfirm'
  artifacts:
    paths:
      - "$CI_PROJECT_NAME*.zst"
      - "yay"

yay_before:
  stage: install_before
  image: docker.io/archlinux:latest
  dependencies:
    - makepkg
  before_script:
    - pacman -Syu --noconfirm sudo
    - cp yay /usr/sbin/yay
    - useradd builduser -m && passwd -d builduser
    - printf 'builduser ALL=(ALL) ALL\n' | tee -a /etc/sudoers
    - sudo -u builduser bash -c 'yay --noconfirm'
  script:
    - sudo -u builduser bash -c 'yay -U --noconfirm *.zst'

aur:
  stage: deploy
  rules:
    - if: $CI_COMMIT_BRANCH == "master"
  image: docker.io/archlinux:latest
  dependencies:
    - makepkg
  before_script:
    - pacman -Syu --noconfirm sudo
    - cp yay /usr/sbin/yay
    - useradd builduser -m && passwd -d builduser
    - printf 'builduser ALL=(ALL) ALL\n' | tee -a /etc/sudoers
    - sudo -u builduser bash -c 'yay --noconfirm'
    - sudo -u builduser bash -c 'yay -S --noconfirm openssh git'
    - sudo -u builduser bash -c 'echo $SSH_KEY_B64 | base64 -di > ~/.ssh/id_rsa'
    - sudo -u builduser bash -c 'git remote add aur ssh://aur@aur.archlinux.org/$CI_PROJECT_NAME.git'
    - sudo -u builduser bash -c 'git fetch aur'
  script:
    - sudo -u builduser bash -c 'git push aur master'
    - sleep 30

yay_after:
  stage: install_after
  rules:
    - if: $CI_COMMIT_BRANCH == "master"
  image: docker.io/archlinux:latest
  dependencies:
    - makepkg
  before_script:
    - pacman -Syu --noconfirm sudo
    - cp yay /usr/sbin/yay
    - useradd builduser -m && passwd -d builduser
    - printf 'builduser ALL=(ALL) ALL\n' | tee -a /etc/sudoers
    - sudo -u builduser bash -c 'yay --noconfirm'
  script:
    - sudo -u builduser bash -c 'yay -S --noconfirm $CI_PROJECT_NAME'