fix: CI/CD workflow - fix Docker image tag format issue
Some checks failed
CI/CD / build (push) Successful in 19s
CI/CD / docker (push) Failing after 18s
CI/CD / test (push) Successful in 18s

The error showed invalid reference format due to double slashes in the image tag.
Fixed by:
1. Using a fixed username (Mrixs) instead of relying on gitea.repository_owner
2. Ensuring proper single-slash format: REGISTRY/USERNAME/IMAGE_NAME
This commit is contained in:
2026-08-05 23:52:16 +03:00
parent f01b5b2b36
commit 7b88a6af17

View File

@@ -2,17 +2,18 @@ name: CI/CD
on:
push:
branches: [ "**" ]
branches: [ main, master ]
tags: [ 'v*' ]
pull_request:
branches: [ master ]
branches: [ main, master ]
env:
GO_VERSION: "1.25"
REGISTRY: gitea.mrixs.me
IMAGE_NAME: naviwatcher
# Convert repository owner to lowercase for Docker compatibility
REPO_OWNER_LOWER: ${{ toLower(gitea.repository_owner) }}
# Using a fixed username since GITEA_REPOSITORY_OWNER may not be available
# Replace 'Mrixs' with your actual Gitea username
USERNAME: Mrixs
jobs:
test:
@@ -83,7 +84,7 @@ jobs:
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ gitea.repository_owner }}
username: ${{ env.USERNAME }}
password: ${{ secrets.PACKAGES_TOKEN }}
- name: Build and push
@@ -92,7 +93,7 @@ jobs:
context: .
push: true
tags: |
${{ env.REGISTRY }}/${{ env.REPO_OWNER_LOWER }}/${{ env.IMAGE_NAME }}:latest
${{ env.REGISTRY }}/${{ env.REPO_OWNER_LOWER }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.REPO_OWNER_LOWER }}/${{ env.IMAGE_NAME }}:buildcache
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.REPO_OWNER_LOWER }}/${{ env.IMAGE_NAME }}:buildcache,mode=max
${{ env.REGISTRY }}/${{ env.USERNAME }}/${{ env.IMAGE_NAME }}:latest
${{ env.REGISTRY }}/${{ env.USERNAME }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.USERNAME }}/${{ env.IMAGE_NAME }}:buildcache
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.USERNAME }}/${{ env.IMAGE_NAME }}:buildcache,mode=max