Skip to content
Snippets Groups Projects
.gitlab-ci.yml 1.27 KiB
## Template para empacotamento utilizando o Gitlab-ci.
stages:
    - build
    - test
    - deploy

build:
  stage: build
  artifacts:
    paths:
      - build/
  tags:
    - debian-packaging
  script:
    - apt-get update && apt-get install -y devscripts 
    - LINE=$(head -n 1 package/debian/changelog)
    - PACKAGE=$(echo $LINE | cut -d' ' -f1)
    - VERSION=$(echo $LINE | cut -d' ' -f2 | grep -o -E '[0-9]*\.[0-9]*\.[0-9]*')
    - tar --exclude=debian -czf ${PACKAGE}_${VERSION}.orig.tar.gz package/*
    - cd package 
    - debuild -us -uc --lintian-opts --suppress-tags package-installs-apt-preferences
    - cd ../
    - mkdir build/
    - mv ${PACKAGE}* build/
    - echo "Estágio de Build finalizado."

test:
  stage: test
  tags:
    - ubuntu
    - regular
  script:
    - apt-get update && apt-get install -y unattended-upgrades
    - dpkg -i build/*.deb
    - echo "Estágio de Teste finalizado"
  dependencies:
    - build

deploy:
  stage: deploy
  only:
    - master
  tags:
    - ubuntu
    - regular
  script:
    - echo "Estágio de Deploy"
    - apt-get update && apt-get install -y dput ssh
    - eval $(ssh-agent -s)
    - ssh-add <(echo "$PRIV_KEY")
    - dput -u -f --config=dput.cf repo build/*.changes
    - echo "Estágio de Deploy finalizado"
  dependencies:
    - build