Files
test_repo/.gitea/workflows/build-and-push.yaml
gitea_admin 607abefb98
Some checks failed
Build and Push Container Image / build-and-push (push) Failing after 3s
Update .gitea/workflows/build-and-push.yaml
2026-04-27 11:42:05 +00:00

50 lines
1.5 KiB
YAML

name: Build and Push Container Image
on:
push:
branches:
- main
tags:
- "v*"
jobs:
build-and-push:
runs-on: orchestration-platform
container:
image: docker:latest
steps:
- name: Install git
run: apk add --no-cache git
- name: Checkout code
run: |
git clone --branch "${GITHUB_REF_NAME}" "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git" .
- name: Determine image tag
id: meta
run: |
if echo "${{ gitea.ref }}" | grep -q "refs/tags/"; then
TAG=$(echo "${{ gitea.ref }}" | sed 's|refs/tags/||')
else
TAG="latest"
fi
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
- name: Configure Docker for insecure registry
run: |
REGISTRY_HOST=$(echo "${{ gitea.server_url }}" | sed 's|https\?://||')
mkdir -p /etc/docker
echo "{\"insecure-registries\": [\"${REGISTRY_HOST}\"]}" > /etc/docker/daemon.json
- name: Login to Gitea registry
run: |
REGISTRY_HOST=$(echo "${{ gitea.server_url }}" | sed 's|https\?://||')
echo "${{ secrets.REGISTRY_TOKEN }}" | docker login "http://${REGISTRY_HOST}" -u ${{ gitea.actor }} --password-stdin
- name: Build and push 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}"