variables:
  GLUON_BRANCH: "nightly"
  ECDSA_PRIVAT_KEY: "d8b6b90da391e2b8fdf1fec1499539937a35abcea79f2c3c15ae2f9edb5c455f"
  GLUON_VERSION: "v2016.1.3"

stages:
  - build
  - sign
  - deploy

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

#build:ar71xx-nand:
#  stage: build
#  tags:
#    - firmware
#  script:
#    - bash build/build-ar71xx-nand.sh

sign:
  stage: sign
  only:
    - master
    - citest
  tags:
    - firmware
  script:
    - bash build/sign.sh $GLUON_BRANCH $ECDSA_PRIVAT_KEY
  dependencies:
    - build:ar71xx-generic
#    - build:ar71xx-nand
  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
