2023-07-20 21:25:13 +03:00
|
|
|
#!/usr/bin/env bash
|
2022-08-29 16:13:25 +03:00
|
|
|
|
2022-08-30 16:49:59 +03:00
|
|
|
set -e
|
2022-08-29 16:13:25 +03:00
|
|
|
|
|
|
|
if [[ "${SHOULD_BUILD}" != "yes" ]]; then
|
|
|
|
echo "Will not update version JSON because we did not build"
|
2023-07-23 19:35:27 +03:00
|
|
|
exit 0
|
2022-08-29 16:13:25 +03:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -z "${GITHUB_TOKEN}" ]]; then
|
|
|
|
echo "Will not update insider.json because no GITHUB_TOKEN defined"
|
2023-07-23 19:35:27 +03:00
|
|
|
exit 0
|
2022-08-29 16:13:25 +03:00
|
|
|
fi
|
|
|
|
|
2023-07-20 21:25:13 +03:00
|
|
|
jsonTmp=$( jq --arg 'tag' "${MS_TAG/\-insider/}" --arg 'commit' "${MS_COMMIT}" '. "insider.json" | .tag=$tag | .commit=$commit' )
|
|
|
|
echo "${jsonTmp}" > "insider.json" && unset jsonTmp
|
2022-08-30 16:17:00 +03:00
|
|
|
|
2022-10-06 23:15:41 +03: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 16:13:25 +03:00
|
|
|
git add .
|
|
|
|
|
|
|
|
CHANGES=$( git status --porcelain )
|
|
|
|
|
2023-07-20 21:25:13 +03:00
|
|
|
if [[ -n "${CHANGES}" ]]; then
|
2022-08-29 16:13:25 +03:00
|
|
|
git commit -m "build(insider): update to commit ${MS_COMMIT:0:7}"
|
2022-08-30 16:17:00 +03:00
|
|
|
|
2022-08-30 16:01:09 +03:00
|
|
|
if ! git push origin insider --quiet; then
|
|
|
|
git pull origin insider
|
|
|
|
git push origin insider --quiet
|
2022-08-29 16:13:25 +03:00
|
|
|
fi
|
|
|
|
fi
|