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

variables:
  REPODIR: "$CI_PROJECT_DIR"

stages:
7
  - build
AlmAck's avatar
AlmAck committed
8 9 10 11 12 13 14
  - deploy

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
15 16
  # setup makepkg settings (enable and sync the correct repository), as root
  - _gitlab-ci-scripts/prepare_makepkg.sh
Chaoting Liu's avatar
Chaoting Liu committed
17 18
  # configure encryption environments
  - sudo -u builder -E -H _gitlab-ci-scripts/prepare_keys.sh
AlmAck's avatar
AlmAck committed
19

20 21 22
makepkg:
  stage: build
  only:
Jeff Huang's avatar
Jeff Huang committed
23
    - merge_requests
AlmAck's avatar
AlmAck committed
24 25 26 27 28 29 30 31
  script:
    # 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
32
    when: always
AlmAck's avatar
AlmAck committed
33
    paths:
34
      - ./_repo/gitlab-ci/*.pkg.tar.*
35
      - ./_logs/*.log
AlmAck's avatar
AlmAck committed
36 37 38 39
    name: "$CI_BUILD_NAME"
  cache:
    paths:
      - /var/cache/pacman/pkg
40
      - ./_sources
AlmAck's avatar
AlmAck committed
41 42 43 44 45
  tags:
    - PKGBUILD

deploy_pkgs:
  stage: deploy
Chaoting Liu's avatar
Chaoting Liu committed
46 47 48 49 50 51
  only:
    - merge_requests
  when: manual
  environment:
    name: staging
    url: https://rsync.chakralinux.org/packages/testing/x86_64/
Chaoting Liu's avatar
Chaoting Liu committed
52 53
  variables:
    DEST_REPO: "testing"
AlmAck's avatar
AlmAck committed
54 55 56 57 58
  script:
     - _gitlab-ci-scripts/deploy.sh
  tags:
    - rsync

Chaoting Liu's avatar
Chaoting Liu committed
59 60 61 62
production:
  stage: deploy
  only:
    - master@chakra/packages/desktop
AlmAck's avatar
AlmAck committed
63
  when: manual
Chaoting Liu's avatar
Chaoting Liu committed
64 65 66
  environment:
    name: production
    url: https://rsync.chakralinux.org/packages/desktop/x86_64/
Chaoting Liu's avatar
Chaoting Liu committed
67 68
  variables:
    DEST_REPO: "desktop"
Chaoting Liu's avatar
Chaoting Liu committed
69 70
  script:
     - _gitlab-ci-scripts/deploy.sh
AlmAck's avatar
AlmAck committed
71 72
  tags:
    - rsync