Files
JavadocViewerService/.gitea/workflows/deploy-image.yml
T
thischwa ab514c50bf
Build and Push Docker Image / build-and-push (push) Failing after 9s
Format Debug Secret step in deploy-image.yml for consistent indentation
2026-06-30 09:18:30 +02:00

62 lines
1.9 KiB
YAML

name: Build and Push Docker Image
on:
push:
workflow_dispatch:
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Compute image name and tag
id: meta
run: |
REGISTRY=$(echo "${{ github.server_url }}" | sed 's|https\?://||')
OWNER=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')
ACTOR=$(echo "${{ github.actor }}" | tr '[:upper:]' '[:lower:]')
IMAGE_NAME="javadocviewerservice"
FULL_IMAGE="${REGISTRY}/${OWNER}/${IMAGE_NAME}"
REF="${{ github.ref_name }}"
if [ "${REF}" = "main" ]; then
TAG="latest"
else
TAG=$(echo "${REF}" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9._-]/-/g')
fi
echo "Registry: ${REGISTRY}"
echo "Actor: ${ACTOR}"
echo "Image: ${FULL_IMAGE}:${TAG}"
echo "registry=${REGISTRY}" >> "$GITHUB_OUTPUT"
echo "actor=${ACTOR}" >> "$GITHUB_OUTPUT"
echo "image=${FULL_IMAGE}" >> "$GITHUB_OUTPUT"
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
- name: Network Debug
run: |
curl -v https://git.mein-gateway.de/v2/
- name: Debug Secret
run: |
echo "Secret length: ${#TOKEN}"
env:
TOKEN: ${{ secrets.REGISTRY_TOKEN }}
- name: Log in to Gitea Container Registry
run: echo "${{ secrets.GITEA_TOKEN }}" | docker login "${{ steps.meta.outputs.registry }}" -u "${{ steps.meta.outputs.actor }}" --password-stdin
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.image }}:${{ steps.meta.outputs.tag }}