stages:
  - deploy

image: alpine:latest

scripts:
  stage: deploy
  rules:
    - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
      changes:
      - deployScriptsAll.bash
      - deployScripts.bash
      - /*.{pl}
    - when: manual

  before_script:
    - echo "install additional packages"
    - apk update
    - apk upgrade
    - echo "Install Bash"
    - apk add bash
    - echo "Install Core Utils"
    - apk add coreutils
    - echo "Install Git"
    - apk add git
    - echo "Set Git credentials"
    - git config --global user.email "silvan.zahno@hevs.ch"
    - git config --global user.name "Silvan Zahno"
    - echo "Setting up deploy-eda_scripts environment"

  script:
    - bash ./deployScriptsAll.bash

libs_trigger:
  stage: deploy
  rules:
    - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
      changes:
      - deployLibsAll.bash
      - deployLibs.bash
    - when: manual
  variables:
    GIT_CHECKOUT: "false"
  
  before_script:
    - echo "install additional packages"
    - apk update
    - apk upgrade
    - echo "Install Curl"
    - apk add curl

  script:
    - 'curl -X POST --fail -F token=glptt-0235c37f03e3060733df7d1151555fd0c63d0adb -F ref=master "https://gitlab.hevs.ch/api/v4/projects/762/trigger/pipeline"'
