.gitlab-ci.yml 2.21 KB
Newer Older
AlmAck's avatar
AlmAck committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
image: chakralinux/makepkg:latest

variables:
  REPODIR: "$CI_PROJECT_DIR"

stages:
  - package
  - sign
  - deploy
  - stable

before_script:
  # import the gitlab-ci scripts
  - git clone --depth 1 https://code.chakralinux.org/tools/chakra-gitlab-ci-scripts _gitlab-ci-scripts
  # setup basic environment settings, as root
  - _gitlab-ci-scripts/prepare.sh
  # import pgp keys flagged as valid
  - sudo -u builder -E -H _gitlab-ci-scripts/import-validpgpkeys.sh

build_pkgs:
  stage: package
Jeff Huang's avatar
Jeff Huang committed
22 23 24
  except:
    - master
    - merge_requests
AlmAck's avatar
AlmAck committed
25 26 27 28 29 30 31 32 33 34
  script:
    # setup makepkg settings (enable and sync the correct repository), as root
    - _gitlab-ci-scripts/prepare_makepkg.sh
    # the build script can't be run as root, as makepkg would complain...
    - sudo -u builder -E -H _gitlab-ci-scripts/build.sh

  artifacts:
    # expire artifacts per default - the gitlab web frontend can be used to keep
    # artifacts of interest for an unlimited time
    expire_in: 1 week
Luca Giambonini's avatar
Luca Giambonini committed
35
    when: always
AlmAck's avatar
AlmAck committed
36
    paths:
37
      - ./_repo/gitlab-ci/*.pkg.tar.xz
38
      - ./_logs/*.log
AlmAck's avatar
AlmAck committed
39 40 41 42
    name: "$CI_BUILD_NAME"
  cache:
    paths:
      - /var/cache/pacman/pkg
43
      - ./_sources
AlmAck's avatar
AlmAck committed
44 45 46 47 48
  tags:
    - PKGBUILD

sign_pkgs:
  stage: sign
Jeff Huang's avatar
Jeff Huang committed
49 50 51
  except:
    - master
    - merge_requests
AlmAck's avatar
AlmAck committed
52 53 54 55 56 57 58
  script:
     - for pkg in $(find . -type f | grep ".pkg.tar.xz"); do echo "signing $pkg" && echo "$GPG_PASSWORD" | gpg -sb --pinentry-mode loopback --passphrase-fd 0 $pkg; done
  artifacts:
    # expire artifacts per default - the gitlab web frontend can be used to keep
    # artifacts of interest for an unlimited time
    expire_in: 1 week
    paths:
59
      - ./_repo/gitlab-ci/*.pkg.tar.xz.sig
AlmAck's avatar
AlmAck committed
60 61 62 63 64 65
    name: "$CI_BUILD_NAME"
  tags:
    - signature

deploy_pkgs:
  stage: deploy
Jeff Huang's avatar
Jeff Huang committed
66 67
  except:
    - master
AlmAck's avatar
AlmAck committed
68 69 70 71 72 73 74 75 76 77 78 79 80
  variables:
    DEPLOY_SERVER: "$DEPLOY_SERVER"
    SSH_USER: "$SSH_USER"
    SSH_PORT: "$SSH_PORT"
    GPG_PASSWORD: "$GPG_PASSWORD"
  script:
     - _gitlab-ci-scripts/deploy.sh
  when: manual
  tags:
    - rsync

move_pkgs_to_stable:
  stage: stable
Jeff Huang's avatar
Jeff Huang committed
81 82
  except:
    - master
AlmAck's avatar
AlmAck committed
83 84 85 86 87 88 89 90 91 92 93
  variables:
    DEPLOY_SERVER: "$DEPLOY_SERVER"
    SSH_USER: "$SSH_USER"
    SSH_PORT: "$SSH_PORT"
    GPG_PASSWORD: "$GPG_PASSWORD"
    DEST_REPO: "desktop"
  script:
     - _gitlab-ci-scripts/move.sh
  when: manual
  tags:
    - rsync