update_upstream.sh 763 B

123456789101112131415161718192021222324252627
  1. #!/usr/bin/env bash
  2. # shellcheck disable=SC2129
  3. set -e
  4. if [[ "${SHOULD_BUILD}" != "yes" ]]; then
  5. echo "Will not update version JSON because we did not build"
  6. exit 0
  7. fi
  8. jsonTmp=$( cat "./upstream/${VSCODE_QUALITY}.json" | jq --arg 'tag' "${MS_TAG/\-insider/}" --arg 'commit' "${MS_COMMIT}" '. | .tag=$tag | .commit=$commit' )
  9. echo "${jsonTmp}" > "./upstream/${VSCODE_QUALITY}.json" && unset jsonTmp
  10. git add .
  11. CHANGES=$( git status --porcelain )
  12. if [[ -n "${CHANGES}" ]]; then
  13. git commit -S -m "build(${VSCODE_QUALITY}): update to commit ${MS_COMMIT:0:7}"
  14. BRANCH_NAME=$( git rev-parse --abbrev-ref HEAD )
  15. if ! git push origin "${BRANCH_NAME}" --quiet; then
  16. git pull origin "${BRANCH_NAME}"
  17. git push origin "${BRANCH_NAME}" --quiet
  18. fi
  19. fi