.gitlab-ci.yml 1.59 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 20 21 22

build_repo:
  stage: package
  script:
    # the build script can't be run as root, as makepkg would complain...
23
    - sudo -u builder -E -H _gitlab-ci-scripts/build.sh
AlmAck's avatar
AlmAck committed
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40

  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
41
     - 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
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
  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

deploy_repo:
  stage: deploy
  variables:
    DEPLOY_SERVER: "$DEPLOY_SERVER"
    SSH_USER: "$SSH_USER"
    SSH_PORT: "$SSH_PORT"
  environment: staging-repo
  script:
60
     - _gitlab-ci-scripts/deploy.sh
AlmAck's avatar
AlmAck committed
61 62 63
  when: manual
  tags:
    - rsync