update_upstream.sh 832 B

12345678910111213141516171819202122232425262728293031
  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. # stage notary files
  11. git add upstream/*
  12. # discard changed files
  13. git restore .
  14. CHANGES=$( git status --porcelain )
  15. if [[ -n "${CHANGES}" ]]; then
  16. git commit -S -m "build(${VSCODE_QUALITY}): update to commit ${MS_COMMIT:0:7}"
  17. BRANCH_NAME=$( git rev-parse --abbrev-ref HEAD )
  18. if ! git push origin "${BRANCH_NAME}" --quiet; then
  19. git pull origin "${BRANCH_NAME}"
  20. git push origin "${BRANCH_NAME}" --quiet
  21. fi
  22. fi