feat(scripts): Support Github Actions environment variables for version.json

This commit is contained in:
Jon Buckley 2024-08-21 15:04:31 -04:00
Родитель 3ee23b407d
Коммит 48f20d2189
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 5E8CDFF2B02729E8
1 изменённых файлов: 23 добавлений и 7 удалений

Просмотреть файл

@ -2,10 +2,26 @@
DIR=$(dirname "$0")
printf '{"version":{"hash":"%s","version":"%s","source":"https://github.com/%s/%s","build":"%s"}}\n' \
"${CIRCLE_SHA1:-$(git rev-parse HEAD)}" \
"${CIRCLE_TAG:-$(git rev-parse --abbrev-ref HEAD)}" \
"${CIRCLE_PROJECT_USERNAME:-mozilla}" \
"${CIRCLE_PROJECT_REPONAME:-fxa}" \
"${CIRCLE_BUILD_URL}" \
| tee "$DIR/../packages/version.json"
if [[ "${CIRCLECI}" == "true" ]]; then
printf '{"version":{"hash":"%s","version":"%s","source":"https://github.com/%s/%s","build":"%s"}}\n' \
"${CIRCLE_SHA1:-$(git rev-parse HEAD)}" \
"${CIRCLE_TAG:-$(git rev-parse --abbrev-ref HEAD)}" \
"${CIRCLE_PROJECT_USERNAME:-mozilla}" \
"${CIRCLE_PROJECT_REPONAME:-fxa}" \
"${CIRCLE_BUILD_URL}" \
| tee "$DIR/../packages/version.json"
elif [[ "${GITHUB_ACTIONS}" == "true" ]]; then
printf '{"version":{"hash":"%s","version":"%s","source":"https://github.com/%s","build":"%s/%s/actions/runs/%s"}}\n' \
"${GITHUB_SHA}" \
"${GITHUB_REF_NAME}" \
"${GITHUB_REPOSITORY}" \
"${GITHUB_SERVER_URL}" \
"${GITHUB_REPOSITORY}" \
"${GITHUB_RUN_ID}" \
| tee "$DIR/../packages/version.json"
else
printf '{"version":{"hash":"%s","version":"%s","source":"https://github.com/mozilla/fxa","build":""}}\n' \
"$(git rev-parse HEAD)" \
"$(git rev-parse --abbrev-ref HEAD)" \
| tee "$DIR/../packages/version.json"
fi