stages:
#    - test
    - download
    - build
    - deploy

#test:
#  stage: test
#  script:
#    - echo "This job tests something"
#  tags:
#    - xcode_12_2

download_artifacts:
  stage: download
  script:
    - ./Scripts/download_dependencies.sh
  only:
    - branches
    - develop
  tags:
    - bash_shell
  environment:
    name: oneartifactory
    url: https://oneartifactoryci.verizon.com/artifactory
  variables:
    ARTIFACTORY_URL: https://oneartifactoryci.verizon.com/artifactory
    
build_project:
  stage: build
  script:
    - ./Scripts/build_aggregate.sh
  only:
    - branches
    - develop
  tags:
    - xcode_12_2

deploy_snapshot:
  stage: deploy
  script:
    - cd Scripts && ./upload_core_ui_frameworks.sh
  only:
    - branches
    - develop
  tags:
    - bash_shell
  environment:
    name: oneartifactory
    url: https://oneartifactoryci.verizon.com/artifactory
  variables:
    ARTIFACTORY_URL: https://oneartifactoryci.verizon.com/artifactory

#promote_snapshot:
#  stage: go live
#  # Prevent artifacts from needing to re-download. Everything we need is in Artifactory.
#  dependencies: []
#  script:
#    # Grab the framework version from the xcode project.
#    - framework_ver=$(cd RemoteView && agvtool vers -terse)
#    - cd Scripts && ./promote_remote_view_frameworks.sh $framework_ver
#  only:
#    - tags
#  tags:
#    - bash_shell
#  environment:
#    name: oneartifactory
#    url: https://oneartifactoryci.verizon.com/artifactory
#  variables:
#    ARTIFACTORY_URL: https://oneartifactoryci.verizon.com/artifactory
#
#create_version_tag:
#  stage: tag
#  when: manual
#  # Prevent artifacts from needing to re-download.
#  dependencies: []
#  script:
#    # Grab the framework version from the xcode project and create a tag of the version.
#    - framework_ver=$(cd RemoteView && agvtool vers -terse)
#    - git tag -a "v${framework_ver}" -m "Version ${framework_ver} created by gitlab-ci Build"
#    # Extract the git repo url to ssh version (git@gitlab.verizon.com)
#    - ci_push_repo="git@${CI_SERVER_HOST}:${CI_PROJECT_PATH}.git"
#    - echo $ci_push_repo
#    # Set the remote url for pushing assuming the gitlab runner has SSH access to the repo.
#    - git remote set-url --push origin $ci_push_repo
#    - git push origin "v${framework_ver}"
#  only:
#    - develop
#  tags:
#    - bash_shell
