.gitlab-ci.yml 1.71 KB
Newer Older
1
image: chakralinux/makepkg:latest
AlmAck's avatar
AlmAck committed
2 3 4 5 6 7 8 9 10 11

variables:
  REPODIR: "$CI_PROJECT_DIR"

stages:
  - package
  - sign
  - deploy

before_script:
12 13
  # import the gitlab-ci scripts
  - git clone --depth 1 https://code.chakralinux.org/tools/chakra-gitlab-ci-scripts _gitlab-ci-scripts
AlmAck's avatar
AlmAck committed
14
  # setup basic environment settings, as root
15
  - _gitlab-ci-scripts/prepare.sh
AlmAck's avatar
AlmAck committed
16
  # import pgp keys flagged as valid
17
  - sudo -u builder -E -H _gitlab-ci-scripts/import-validpgpkeys.sh
AlmAck's avatar
AlmAck committed
18

19
build_pkgs:
AlmAck's avatar
AlmAck committed
20 21
  stage: package
  script:
22 23
    # setup makepkg settings (enable and sync the correct repository), as root
    - _gitlab-ci-scripts/prepare_makepkg.sh
AlmAck's avatar
AlmAck committed
24
    # the build script can't be run as root, as makepkg would complain...
25
    - sudo -u builder -E -H _gitlab-ci-scripts/build.sh
AlmAck's avatar
AlmAck committed
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42

  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:
      - ./*.pkg.tar.xz
    name: "$CI_BUILD_NAME"
  cache:
    paths:
      - /var/cache/pacman/pkg
  tags:
    - PKGBUILD

sign_pkgs:
  stage: sign
  script:
AlmAck's avatar
AlmAck committed
43
     - 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
AlmAck's avatar
AlmAck committed
44 45 46 47 48 49 50 51 52 53
  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:
      - ./*.pkg.tar.xz.sig
    name: "$CI_BUILD_NAME"
  tags:
    - signature

54
deploy_pkgs:
AlmAck's avatar
AlmAck committed
55 56 57 58 59 60 61
  stage: deploy
  variables:
    DEPLOY_SERVER: "$DEPLOY_SERVER"
    SSH_USER: "$SSH_USER"
    SSH_PORT: "$SSH_PORT"
  environment: staging-repo
  script:
62
     - _gitlab-ci-scripts/deploy.sh
AlmAck's avatar
AlmAck committed
63 64 65
  when: manual
  tags:
    - rsync