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

variables:
  REPODIR: "$CI_PROJECT_DIR"

stages:
  - package
  - sign
  - deploy
10
  - stable
AlmAck's avatar
AlmAck committed
11 12

before_script:
13 14
  # 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
15
  # setup basic environment settings, as root
16
  - _gitlab-ci-scripts/prepare.sh
AlmAck's avatar
AlmAck committed
17
  # import pgp keys flagged as valid
18
  - sudo -u builder -E -H _gitlab-ci-scripts/import-validpgpkeys.sh
AlmAck's avatar
AlmAck committed
19

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

  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:
33
      - _gitlab-ci-scripts/prepare_makepkg.sh
AlmAck's avatar
AlmAck committed
34 35 36 37
    name: "$CI_BUILD_NAME"
  cache:
    paths:
      - /var/cache/pacman/pkg
38
      - ./_sources
AlmAck's avatar
AlmAck committed
39 40 41 42 43 44
  tags:
    - PKGBUILD

sign_pkgs:
  stage: sign
  script:
AlmAck's avatar
AlmAck committed
45
     - 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
46 47 48 49 50 51 52 53 54 55
  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

56
deploy_pkgs:
AlmAck's avatar
AlmAck committed
57 58 59 60 61
  stage: deploy
  variables:
    DEPLOY_SERVER: "$DEPLOY_SERVER"
    SSH_USER: "$SSH_USER"
    SSH_PORT: "$SSH_PORT"
62
    GPG_PASSWORD: "$GPG_PASSWORD"
AlmAck's avatar
AlmAck committed
63 64
  environment: staging-repo
  script:
65
     - _gitlab-ci-scripts/deploy.sh
AlmAck's avatar
AlmAck committed
66 67 68
  when: manual
  tags:
    - rsync
69 70 71 72 73 74 75 76

move_pkgs_to_stable:
  stage: stable
  variables:
    DEPLOY_SERVER: "$DEPLOY_SERVER"
    SSH_USER: "$SSH_USER"
    SSH_PORT: "$SSH_PORT"
    GPG_PASSWORD: "$GPG_PASSWORD"
77
    DEST_REPO: "gtk"
78 79 80 81 82 83
  environment: stable-repo
  script:
     - _gitlab-ci-scripts/move.sh
  when: manual
  tags:
    - rsync