include:
  - project: "devops/pena-continuous-integration"
    file: "/templates/docker/build-template.gitlab-ci.yml"
  - project: "devops/pena-continuous-integration"
    file: "/templates/docker/deploy-template.gitlab-ci.yml"
  - project: "devops/pena-continuous-integration"
    file: "/templates/docker/service-discovery.gitlab-ci.yml"
stages:
  - build
  - deploy
  - service-discovery

build-app:
  tags:
    - frontbuild
  extends: .build_template
  variables:
    DOCKER_BUILD_PATH: "./Dockerfile"
    STAGING_BRANCH: "staging"
    PRODUCTION_BRANCH: "main"

deploy-to-staging:
  tags:
    - front
    - staging
  rules:
    - if: "$CI_COMMIT_BRANCH == $STAGING_BRANCH"
  extends: .deploy_template


deploy-to-prod:
  tags:
    - front
    - prod
  rules:
    - if: "$CI_COMMIT_BRANCH == $PRODUCTION_BRANCH"
  extends: .deploy_template

service-discovery:
  extends: .sd_artefacts_template
