variables:
  GLUON_BRANCH: "nightly"
  ECDSA_PRIVAT_KEY: "d8b6b90da391e2b8fdf1fec1499539937a35abcea79f2c3c15ae2f9edb5c455f"
  GLUON_VERSION: "v2016.1.x"

stages:
  - build
  - sign
  - deploy

build:gluon:
  stage: build
  only:
    - master
    - citest
  tags:
    - firmware
  script:
    - bash build/target.sh $GLUON_BRANCH $GLUON_VERSION
  artifacts:
    paths:
      - output/images/factory/*wr841*
      - output/images/sysupgrade/*manifest
      - output/images/sysupgrade/*wr841*
      - contrib/

sign:
  stage: sign
  only:
    - master
    - citest
  tags:
    - firmware
  script:
    - bash build/sign.sh $GLUON_BRANCH $ECDSA_PRIVAT_KEY
  dependencies:
    - build:gluon
  artifacts:
    paths:
      - output/images/

deploy:
  stage: deploy
  only:
    - master
    - citest
  tags:
    - firmware
  script:
    - bash build/deploy.sh $GLUON_BRANCH $CI_BUILD_REF_NAME
  dependencies:
    - sign
