Update .gitea/workflows/build-and-push.yaml
Some checks failed
Build and Push Container Image / build-and-push (push) Failing after 4s

This commit is contained in:
2026-04-27 11:46:41 +00:00
parent a77cd96c26
commit 2d86689cc6

View File

@@ -14,8 +14,11 @@ jobs:
image: docker:latest
steps:
- name: Install git
run: apk add --no-cache git
- name: Install tools
run: |
apk add --no-cache git curl
# Install crane for pushing to insecure registries
curl -sL https://github.com/google/go-containerregistry/releases/latest/download/go-containerregistry_Linux_x86_64.tar.gz | tar -xz -C /usr/local/bin crane
- name: Checkout code
run: |
@@ -31,24 +34,16 @@ jobs:
fi
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
- name: Setup registry auth
run: |
REGISTRY_HOST=$(echo "${{ gitea.server_url }}" | sed 's|https\?://||')
AUTH=$(echo -n "${{ gitea.actor }}:${{ secrets.REGISTRY_TOKEN }}" | base64)
mkdir -p ~/.docker
cat > ~/.docker/config.json <<EOF
{
"auths": {
"${REGISTRY_HOST}": {
"auth": "${AUTH}"
}
}
}
EOF
- name: Build and push image
- name: Build image
run: |
REGISTRY_HOST=$(echo "${{ gitea.server_url }}" | sed 's|https\?://||')
IMAGE="${REGISTRY_HOST}/${{ gitea.repository }}:${{ steps.meta.outputs.tag }}"
docker build -t "${IMAGE}" .
docker push "${IMAGE}"
docker save "${IMAGE}" -o image.tar
- name: Push image
run: |
REGISTRY_HOST=$(echo "${{ gitea.server_url }}" | sed 's|https\?://||')
IMAGE="${REGISTRY_HOST}/${{ gitea.repository }}:${{ steps.meta.outputs.tag }}"
crane auth login "${REGISTRY_HOST}" -u "${{ gitea.actor }}" -p "${{ secrets.REGISTRY_TOKEN }}" --insecure
crane push image.tar "${IMAGE}" --insecure