OPSI-gitlab-ci.yml (Source)

stages:
- build-dev
- deploy-dev
- build-release
- deploy-release

build-release:
 stage: build-release
 only:
  - master
  - tags
 except:
  - branches
 tags:
  - master
 script:
  - STR="$CI_COMMIT_TAG"
  - echo $CI_COMMIT_TAG
  - IFS='-' read -ra VERSION <<< "$STR"
  - PAKETVERSION=version:${VERSION[1]}
  - PRODUKTVERSION=version:${VERSION[0]}
  - echo $PAKETVERSION
  - sed -i '/^\[Package\]$/,/^\[/ s/^version.*$/'$PAKETVERSION'/' ./OPSI/control
  - sed -i '/^\[Product\]$/,/^\[/ s/^version.*$/'$PRODUKTVERSION'/' ./OPSI/control
  - cat ./OPSI/control
  - opsi-makepackage
 artifacts:
  expire_in: 2 days
  paths:
   - ./*.opsi

deploy-release:
  stage: deploy-release
  only:
    - master
    - tags
  except:
    - branches
  tags:
   - master
  script:
    - opsi-package-manager -i -q *.opsi
  dependencies:
    - build-release

build-dev:
 stage: build-dev
 only:
   - dev
   - /^dev.*$/
 tags:
   - development
 script:
   - opsi-makepackage
 artifacts:
  expire_in: 2 days
  paths:
   - ./*.opsi

deploy-dev:
  stage: deploy-dev
  only:
    - dev
    - /^dev.*$/
  tags:
    - development
  script:
    - opsi-package-manager -i -q *.opsi
  dependencies:
    - build-dev