fix(docker): Use git tag from lookup

The `GITHUB_REF_NAME` variable only works for tags pushed by developers.
When calling the docker.yml workflow from tag-release.yml, the contents
of `GITHUB_REF_NAME` is `main`, the branch that the GitHub Action is
running on. This will fix the version output for x.y.0 tags created by
tag-release.yml.
This commit is contained in:
Jon Buckley 2024-10-12 14:21:24 -04:00
Родитель 496ecb05e4
Коммит 1748d4579a
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 5E8CDFF2B02729E8
2 изменённых файлов: 4 добавлений и 4 удалений

6
.github/workflows/docker.yml поставляемый
Просмотреть файл

@ -49,13 +49,13 @@ jobs:
GCP_PROJECT_ID: moz-fx-fxa-prod
IMAGE: fxa-mono
RUN_ID: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
TAG: ${{ needs.tag.outputs.TAG }}
GIT_TAG: ${{ needs.tag.outputs.TAG }}
needs:
- tag
steps:
- uses: actions/checkout@v4
with:
ref: ${{ env.TAG }}
ref: ${{ env.GIT_TAG }}
- uses: actions/setup-node@v4
with:
@ -87,7 +87,7 @@ jobs:
with:
context: .
file: _dev/docker/mono/Dockerfile
tags: ${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.GCP_PROJECT_ID }}/${{ env.GAR_REPOSITORY}}/${{ env.IMAGE}}:${{ env.TAG }}
tags: ${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.GCP_PROJECT_ID }}/${{ env.GAR_REPOSITORY}}/${{ env.IMAGE}}:${{ env.GIT_TAG }}
push: true
cache-from: type=gha
cache-to: type=gha,mode=max

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

@ -13,7 +13,7 @@ if [[ "${CIRCLECI}" == "true" ]]; then
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}" \
"${GIT_TAG}" \
"${GITHUB_REPOSITORY}" \
"${GITHUB_SERVER_URL}" \
"${GITHUB_REPOSITORY}" \