Files
Gitea-docker-runner-test/.gitea/workflows/build-and-push.yaml
Grzegorz Matoga cf9c95038a
Some checks failed
Build and Push Docker Image / build (push) Failing after 5s
refactor: update git clone command to remove https prefix and streamline environment variables
2025-07-24 18:24:59 +02:00

33 lines
1.1 KiB
YAML

name: Build and Push Docker Image
on:
push:
branches: [ main ]
jobs:
build:
runs-on: runner
container: docker:24-git
steps:
- name: Clone repository
run: |
# Remove the https:// prefix since gitea.server_url already includes it
git clone ${{ gitea.server_url }}/${{ gitea.repository }}.git .
git checkout ${{ gitea.sha }}
env:
GIT_ASKPASS: /bin/echo
GIT_USERNAME: ${{ gitea.actor }}
GIT_PASSWORD: ${{ secrets.GITEATOKEN }}
- name: Build and push
run: |
# Login to registry
echo "${{ secrets.GITEATOKEN }}" | docker login "${{ gitea.server_url }}" -u "${{ gitea.actor }}" --password-stdin
# Build with correct image format
IMAGE_NAME="git.eurekin.pl/${{ gitea.repository_owner }}/hello-gitea"
IMAGE_NAME=$(echo "$IMAGE_NAME" | tr '[:upper:]' '[:lower:]')
echo "Building image: $IMAGE_NAME:latest"
docker build -t "${IMAGE_NAME}:latest" .
docker push "${IMAGE_NAME}:latest"