stages:
  - build
  - www.remarkbox.com

build:
  stage: build
  tags: ["build"]
  script:
    - rm -rf .git
    - cd ..; tar -zcvf www.remarkbox.com.tar.gz www.remarkbox.com; mv www.remarkbox.com.tar.gz www.remarkbox.com; cd www.remarkbox.com
    # create sha512 of www.makepostsell.com.tar.gz
    - sha512sum www.remarkbox.com.tar.gz >> www.remarkbox.com.tar.gz.hash
    # create commit-hash.txt to track this build's git commit hash.
    - echo $CI_COMMIT_SHA >> commit-hash.txt

  artifacts:
    paths:
      - www.remarkbox.com.tar.gz
      - www.remarkbox.com.tar.gz.hash
      - commit-hash.txt
    expire_in: 1 month

www.remarkbox.com:
  stage: www.remarkbox.com
  tags: ["www.remarkbox.com"]
  script:
    # publish build to Salt Master
    - sudo /opt/salt-call-state-highstate.sh
  rules:
    - if: '$CI_COMMIT_BRANCH == "master"'