update_insider.sh 818 B

123456789101112131415161718192021222324252627282930
  1. #!/bin/bash
  2. set -e
  3. if [[ "${SHOULD_BUILD}" != "yes" ]]; then
  4. echo "Will not update version JSON because we did not build"
  5. exit
  6. fi
  7. if [[ -z "${GITHUB_TOKEN}" ]]; then
  8. echo "Will not update insider.json because no GITHUB_TOKEN defined"
  9. exit
  10. fi
  11. echo "$( cat "insider.json" | jq --arg 'tag' "${MS_TAG/\-insider/}" --arg 'commit' "${MS_COMMIT}" '. | .tag=$tag | .commit=$commit' )" > "insider.json"
  12. git config user.email "$( echo "${GITHUB_USERNAME}" | awk '{print tolower($0)}' )-ci@not-real.com"
  13. git config user.name "${GITHUB_USERNAME} CI"
  14. git add .
  15. CHANGES=$( git status --porcelain )
  16. if [[ ! -z "${CHANGES}" ]]; then
  17. git commit -m "build(insider): update to commit ${MS_COMMIT:0:7}"
  18. if ! git push origin insider --quiet; then
  19. git pull origin insider
  20. git push origin insider --quiet
  21. fi
  22. fi