Skip to content
Snippets Groups Projects
.gitlab-ci.yml 1.83 KiB
Newer Older
Alexander Dunkel's avatar
Alexander Dunkel committed
stages:
  - badges
  - pages
  - deploy

badges:
  image: "registry.gitlab.vgiscience.org/tud_ifk/miniconda-cidefault:0.0.1"
  stage: badges
  variables:
      GIT_FETCH_EXTRA_FLAGS: --tags
  before_script:
       # initialize conda shell
      - conda init bash
      - source ~/.bashrc
      # activate default ci_env from registry image
      # contains anybadge
      - conda activate ci_env
  script:
      # create badges with version from latest tag
      - git fetch --tags
      - version_str=$(git describe --tags $(git rev-list --tags --max-count=1))
      # - git fetch --tags
      - version_var=$(echo $version_str | grep -E 'v[0-9].[0-9].[0-9]' | tail -n 1 | cut -c2-)
      - echo "Version for badges $version_var"
      - anybadge -l version --value="${version_var}" --file=version.svg --color=green
      - anybadge -l pipeline --value=passing --file=pipeline.svg passing=green failing=red
  artifacts:
    paths:
      # quote because * is a
      # special character in YAML
      - '*.svg'
      - resources/html/
      - 'resources/*.png'
      - 'resources/*.svg'
  only:
    - main

pages:
  stage: pages
  script:
    - mkdir .public
    - cp *.svg .public
    - cp -r resources/html/* .public
    - cp resources/*.png .public
    - cp resources/*.svg .public
    - mv .public public
  artifacts:
    name: pages
    paths:
    - public
  only:
    - main

deploy:
  stage: deploy
  image: "registry.gitlab.vgiscience.org/tud_ifk/rsync-ssh-alpine:alpine3.17-r0-v4"
  before_script:
  - eval $(ssh-agent -s)
  - echo "${SSH_PRIVKEY}" | ssh-add -
  - mkdir -p ~/.ssh
  - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
  script:
  - rsync -avu -zz --no-perms --omit-dir-times --chown=www-data:www-data --chmod=D775,F664 public/ "${PRODUCTION_DESTINATION}"ad/jupyter_python_datascience/
Alexander Dunkel's avatar
Alexander Dunkel committed
  only:
    - main