summarylogtreecommitdiffstats
path: root/.gitlab-ci.yml
blob: 9f6a4fbc268934591c5ef68a87125dfb0ba56f06 (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
variables:
  GIT_STRATEGY: clone


check-for-update:
    image: archlinux:latest
    before_script:
      - pacman-key --init
      - pacman -Syu --noconfirm
      - pacman -Sy --noconfirm sudo binutils git openssh jq
      - git config --global user.email "${GIT_USER_MAIL}"
      - git config --global user.name "${GIT_USER_NAME}"
      - mkdir -p ~/.ssh
      - echo "${GIT_SSH_KEY}" > ~/.ssh/id_rsa
      - echo "${AUR_SSH_KEY}" > ~/.ssh/id_rsa_aur
      - chmod 600 ~/.ssh/id_rsa
      - chmod 600 ~/.ssh/id_rsa_aur
      - ssh-keyscan jonasled.dev >> ~/.ssh/known_hosts
      - ssh-keyscan aur.archlinux.org >> ~/.ssh/known_hosts
      - git checkout master
      - git remote rm origin
      - git remote add origin git@jonasled.dev:jonasled/aptakube-aur.git
    script:
      - latest_version=$(curl https://api.github.com/repos/aptakube/aptakube/releases | jq -r '.[0].tag_name')
      - source PKGBUILD
      - |
        if [ "${pkgver}" == "${latest_version}" ]; then
          echo "Current Version (${pkgver}) is the latest one, nothing to do"
          exit 0
        fi
      - 'echo "New Version available: ${latest_version} (current: ${pkgver})"'
      - 'echo "Updating to the latest version"'
      - ./update.sh ${latest_version}
      - 'echo "Update finished"'
      - 'echo "Creating update"'
      - git add .
      - git commit -m "Update to ${latest_version}"
      - git push --set-upstream origin master
      - git remote add aur ssh://aur@aur.archlinux.org/aptakube-appimage.git
      - GIT_SSH_COMMAND='ssh -i ~/.ssh/id_rsa_aur' git push --set-upstream aur master
    only:
      - schedules