ci(release): deploy automático no Coolify quando o latest muda
Release / Plano (reaproveitar a imagem?) (push) Successful in 6s
CI / Lint e auditorias (push) Successful in 54s
CI / Trivy (dependências e segredos) (push) Successful in 13s
CI / Imagem Docker (linux/arm64) (push) Successful in 4m13s
Release / ci (push) Successful in 5m22s
Release / Publica a imagem (linux/arm64) (push) Successful in 19s
Release / Cria a release no Gitea (push) Skipped
Release / Deploy no Coolify (push) Failing after 1s
Release / Plano (reaproveitar a imagem?) (push) Successful in 6s
CI / Lint e auditorias (push) Successful in 54s
CI / Trivy (dependências e segredos) (push) Successful in 13s
CI / Imagem Docker (linux/arm64) (push) Successful in 4m13s
Release / ci (push) Successful in 5m22s
Release / Publica a imagem (linux/arm64) (push) Successful in 19s
Release / Cria a release no Gitea (push) Skipped
Release / Deploy no Coolify (push) Failing after 1s
O job deploy roda depois de publicar a imagem: pede o deploy pela API do Coolify e acompanha até terminar, falhando o workflow se o deploy falhar. O digest do latest é comparado antes e depois de publicar, então merge só de documentação ou tag (que reapontam o latest para o mesmo manifesto) não reiniciam o container. workflow_dispatch força o deploy. O script do digest fica em .gitea/scripts para não entrar no hash da imagem e não provocar rebuild. Precisa dos secrets COOLIFY_URL e COOLIFY_TOKEN no repositório. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1860e34cbb
commit
b6fb230328
3 files changed
+76
-1
No files matched your search
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
# Uso: .gitea/scripts/digest-latest.sh <registro> <repositório>
|
||||
# Imprime o digest do manifesto de <repositório>:latest, ou nada se a tag ainda
|
||||
# não existe. Fica em .gitea/ para não entrar no hash da imagem (plano-imagem.sh).
|
||||
# O release.yml compara o valor antes e depois de publicar para
|
||||
# decidir se há o que implantar. Com o pacote privado, passe REGISTRY_USER e
|
||||
# REGISTRY_PASSWORD (token com read:package).
|
||||
set -euo pipefail
|
||||
registry=$1; ns=${2,,}
|
||||
|
||||
auth=(); [ -n "${REGISTRY_PASSWORD:-}" ] && auth=(-u "${REGISTRY_USER:?}:$REGISTRY_PASSWORD")
|
||||
token=$(curl -fsS "${auth[@]}" "https://$registry/v2/token?service=container_registry&scope=repository:$ns:pull" | jq -r .token)
|
||||
curl -sSI \
|
||||
-H "Authorization: Bearer $token" \
|
||||
-H 'Accept: application/vnd.oci.image.index.v1+json,application/vnd.docker.distribution.manifest.list.v2+json,application/vnd.oci.image.manifest.v1+json,application/vnd.docker.distribution.manifest.v2+json' \
|
||||
"https://$registry/v2/$ns/manifests/latest" \
|
||||
| tr -d '\r' | awk -F': ' 'tolower($1) == "docker-content-digest" { print $2 }'
|
||||
Reference in new issue
Block a user