From 02119a3acde256a92edd06cf4d00337bb53088ee Mon Sep 17 00:00:00 2001 From: Denozordec Date: Tue, 12 May 2026 13:56:56 +0700 Subject: [PATCH] chore: configure dynamic image naming for frontend and backend in Docker workflow - Added steps to dynamically set the image names for both frontend and backend based on the repository owner and name. - Updated Docker build tags to use the newly configured image names instead of hardcoded values. --- .gitea/workflows/docker.yml | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/docker.yml b/.gitea/workflows/docker.yml index 0a1efdb..a57a727 100644 --- a/.gitea/workflows/docker.yml +++ b/.gitea/workflows/docker.yml @@ -16,6 +16,14 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Configure backend image name + shell: bash + run: | + set -euo pipefail + owner=$(echo "${{ gitea.repository }}" | cut -d/ -f1 | tr '[:upper:]' '[:lower:]') + name=$(echo "${{ gitea.repository }}" | cut -d/ -f2 | tr '[:upper:]' '[:lower:]') + echo "IMAGE_NAME=${{ env.REGISTRY }}/${owner}/${name}-backend" >> "${GITHUB_ENV}" + - name: Prepare backend build context shell: bash run: | @@ -50,8 +58,8 @@ jobs: platforms: linux/amd64 push: true tags: | - ${{ env.REGISTRY }}/${{ gitea.repository }}:backend-latest - ${{ env.REGISTRY }}/${{ gitea.repository }}:backend-${{ gitea.sha }} + ${{ env.IMAGE_NAME }}:latest + ${{ env.IMAGE_NAME }}:${{ gitea.sha }} cache-from: type=gha,scope=backend cache-to: type=gha,mode=max,scope=backend labels: | @@ -67,6 +75,14 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Configure frontend image name + shell: bash + run: | + set -euo pipefail + owner=$(echo "${{ gitea.repository }}" | cut -d/ -f1 | tr '[:upper:]' '[:lower:]') + name=$(echo "${{ gitea.repository }}" | cut -d/ -f2 | tr '[:upper:]' '[:lower:]') + echo "IMAGE_NAME=${{ env.REGISTRY }}/${owner}/${name}-frontend" >> "${GITHUB_ENV}" + - name: Prepare frontend build context shell: bash run: | @@ -107,8 +123,8 @@ jobs: platforms: linux/amd64 push: true tags: | - ${{ env.REGISTRY }}/${{ gitea.repository }}:frontend-latest - ${{ env.REGISTRY }}/${{ gitea.repository }}:frontend-${{ gitea.sha }} + ${{ env.IMAGE_NAME }}:latest + ${{ env.IMAGE_NAME }}:${{ gitea.sha }} cache-from: type=gha,scope=frontend cache-to: type=gha,mode=max,scope=frontend labels: |