2023-07-20 14:25:13 -04:00
|
|
|
#!/usr/bin/env bash
|
2022-08-29 09:13:25 -04:00
|
|
|
|
2022-08-30 09:49:59 -04:00
|
|
|
set -e
|
2022-08-29 09:13:25 -04:00
|
|
|
|
|
|
|
if [[ "${SHOULD_BUILD}" != "yes" ]]; then
|
|
|
|
echo "Will not update version JSON because we did not build"
|
2023-07-23 12:35:27 -04:00
|
|
|
exit 0
|
2022-08-29 09:13:25 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -z "${GITHUB_TOKEN}" ]]; then
|
2023-11-15 11:31:04 -05:00
|
|
|
echo "Will not update ${VSCODE_QUALITY}.json because no GITHUB_TOKEN defined"
|
2023-07-23 12:35:27 -04:00
|
|
|
exit 0
|
2022-08-29 09:13:25 -04:00
|
|
|
fi
|
|
|
|
|
2023-11-15 11:31:04 -05:00
|
|
|
jsonTmp=$( cat "${VSCODE_QUALITY}.json" | jq --arg 'tag' "${MS_TAG/\-insider/}" --arg 'commit' "${MS_COMMIT}" '. | .tag=$tag | .commit=$commit' )
|
|
|
|
echo "${jsonTmp}" > "${VSCODE_QUALITY}.json" && unset jsonTmp
|
2022-08-30 09:17:00 -04:00
|
|
|
|
2022-10-06 16:15:41 -04:00
|
|
|
git config user.email "$( echo "${GITHUB_USERNAME}" | awk '{print tolower($0)}' )-ci@not-real.com"
|
|
|
|
git config user.name "${GITHUB_USERNAME} CI"
|
2022-08-29 09:13:25 -04:00
|
|
|
git add .
|
|
|
|
|
|
|
|
CHANGES=$( git status --porcelain )
|
|
|
|
|
2023-07-20 14:25:13 -04:00
|
|
|
if [[ -n "${CHANGES}" ]]; then
|
2023-12-14 15:11:53 -05:00
|
|
|
git commit -m "build(${VSCODE_QUALITY}): update to commit ${MS_COMMIT:0:7}"
|
2022-08-30 09:17:00 -04:00
|
|
|
|
2023-12-14 15:11:53 -05:00
|
|
|
BRANCH_NAME=$( git rev-parse --abbrev-ref HEAD )
|
|
|
|
|
|
|
|
if ! git push origin "${BRANCH_NAME}" --quiet; then
|
|
|
|
git pull origin "${BRANCH_NAME}"
|
|
|
|
git push origin "${BRANCH_NAME}" --quiet
|
2022-08-29 09:13:25 -04:00
|
|
|
fi
|
|
|
|
fi
|