fix(auth): adopt upstream 0.7.3 retry and publish verified latest

This commit is contained in:
jfeng committed 2026-11-13 21:51:08 -03:00
1 parent b140fdb390
commit 406fcc2e52
8 files changed
+220 -45

No files matched your search

+41 -3
View File
@@ -6,7 +6,8 @@ name: Docker - Build e Publicacao
# git.jf.eng.br/jfeng/evogo:<versao>-<sha7> (tag imutavel do commit)
# - workflow_dispatch com publish_image=true -> idem, versao = target_tag ou VERSION
# - push em maintained-stable -> apenas build + teste + scan (nao publica)
# :latest so e atualizada com promote_latest=true (manual), nunca automaticamente.
# Tags v* aprovadas em maintained-stable tambem promovem :latest apos o push
# das tags imutavel e semantica, evitando a corrida com promote-latest.yml.
on:
push:
@@ -32,6 +33,10 @@ on:
default: false
required: false
concurrency:
group: promote-latest
cancel-in-progress: false
env:
REGISTRY: git.jf.eng.br
IMAGE: git.jf.eng.br/jfeng/evogo
@@ -44,6 +49,36 @@ jobs:
steps:
- name: Checkout do Repositorio
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Validar origem da promocao latest
id: promotion
run: |
PROMOTE=false
if [ "${{ github.ref_type }}" = "tag" ] || [ "${{ github.event.inputs.promote_latest }}" = "true" ]; then
git fetch origin maintained-stable
if git merge-base --is-ancestor HEAD FETCH_HEAD; then
PROMOTE=true
elif [ "${{ github.event.inputs.promote_latest }}" = "true" ]; then
echo "Promocao recusada: commit nao aprovado em maintained-stable"
exit 1
fi
fi
echo "promote=${PROMOTE}" >> "$GITHUB_OUTPUT"
- name: Configurar Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Validar codigo antes da publicacao
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends libjpeg-dev libwebp-dev poppler-utils ffmpeg
go mod verify
go vet ./...
go test -v ./...
- name: Obter Versao e Commit SHA
id: meta
@@ -122,10 +157,13 @@ jobs:
push "$IMAGE:$TAG"
echo "Publicado: $IMAGE:$TAG"
done
if [ "${{ github.event.inputs.promote_latest }}" = "true" ]; then
if [ "${{ steps.promotion.outputs.promote }}" = "true" ]; then
docker tag "$SRC" "$IMAGE:latest"
push "$IMAGE:latest"
echo "Publicado: $IMAGE:latest"
IMMUTABLE_DIGEST=$(docker buildx imagetools inspect "$IMAGE:${{ steps.meta.outputs.image_tag }}" --format '{{json .Manifest.Digest}}')
LATEST_DIGEST=$(docker buildx imagetools inspect "$IMAGE:latest" --format '{{json .Manifest.Digest}}')
[ -n "$IMMUTABLE_DIGEST" ] && [ "$IMMUTABLE_DIGEST" = "$LATEST_DIGEST" ]
echo "Publicado e verificado: $IMAGE:latest = $IMMUTABLE_DIGEST"
fi
- name: Limpeza