[Fix] Correzione autenticazione Gitea Actions
Build and Push Docker Images / Build Linux Container (push) Failing after 1m0s
Build and Push Docker Images / Build Windows Container (push) Has been cancelled
Build and Push Docker Images / Create Multi-Platform Manifest (push) Has been cancelled

- Sostituito gitea.actor con username hardcoded 'alessio'
- Corretto tutti i riferimenti gitea.ref con github.ref
- Gitea Actions usa le stesse variabili di GitHub per compatibilità
- Aggiornata documentazione con spiegazione context variables
- Fix: username nel docker login ora funzionante
This commit is contained in:
2026-01-24 12:33:04 +01:00
parent c74a00511c
commit 5b1d7d1ea2
2 changed files with 25 additions and 20 deletions
+9 -4
View File
@@ -159,14 +159,19 @@ services:
### Principali Differenze ### Principali Differenze
1. **Context Variables**: 1. **Context Variables**:
- GitHub: `github.*` → Gitea: `gitea.*` - Gitea Actions usa le **stesse variabili** di GitHub Actions: `github.*`
- Esempio: `github.actor``gitea.actor` - Esempio: `github.ref`, `github.sha`, `github.actor`
- **Nota**: Anche se il servizio è Gitea, le variabili mantengono il prefisso `github` per compatibilità
2. **Registry**: 2. **Username**:
- Nel workflow è hardcoded come `alessio` per semplicità
- Puoi usare `${{ github.actor }}` se preferisci (utente che ha triggerato il workflow)
3. **Registry**:
- GitHub: `ghcr.io` → Gitea: `gitea.home-nas-ds.org` (istanza self-hosted) - GitHub: `ghcr.io` → Gitea: `gitea.home-nas-ds.org` (istanza self-hosted)
- Gitea non ha un registry pubblico centralizzato come GitHub - Gitea non ha un registry pubblico centralizzato come GitHub
3. **Secret Name**: 4. **Secret Name**:
- GitHub: `GITHUB_TOKEN` (automatico) → Gitea: `GITEA_TOKEN` (configurato manualmente) - GitHub: `GITHUB_TOKEN` (automatico) → Gitea: `GITEA_TOKEN` (configurato manualmente)
4. **Attestation**: 4. **Attestation**:
+16 -16
View File
@@ -49,11 +49,11 @@ jobs:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: | tags: |
# Tag based on branch # Tag based on branch
type=raw,value=latest,enable=${{ gitea.ref == 'refs/heads/main' }} type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
type=raw,value=latest,enable=${{ gitea.ref == 'refs/heads/development' }} type=raw,value=latest,enable=${{ github.ref == 'refs/heads/development' }}
type=raw,value=development-latest,enable=${{ gitea.ref == 'refs/heads/development' }} type=raw,value=development-latest,enable=${{ github.ref == 'refs/heads/development' }}
type=raw,value=dev-latest,enable=${{ gitea.ref == 'refs/heads/dev' }} type=raw,value=dev-latest,enable=${{ github.ref == 'refs/heads/dev' }}
type=raw,value=staging-latest,enable=${{ gitea.ref == 'refs/heads/staging' }} type=raw,value=staging-latest,enable=${{ github.ref == 'refs/heads/staging' }}
# Tag with commit sha # Tag with commit sha
type=sha,prefix={{branch}}-,format=short type=sha,prefix={{branch}}-,format=short
# Tag with date # Tag with date
@@ -89,7 +89,7 @@ jobs:
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
registry: ${{ env.REGISTRY }} registry: ${{ env.REGISTRY }}
username: ${{ gitea.actor }} username: alessio
password: ${{ secrets.GITEA_TOKEN }} password: ${{ secrets.GITEA_TOKEN }}
- name: Extract metadata for Docker - name: Extract metadata for Docker
@@ -99,11 +99,11 @@ jobs:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: | tags: |
# Tag based on branch with windows suffix # Tag based on branch with windows suffix
type=raw,value=latest-windows,enable=${{ gitea.ref == 'refs/heads/main' }} type=raw,value=latest-windows,enable=${{ github.ref == 'refs/heads/main' }}
type=raw,value=latest-windows,enable=${{ gitea.ref == 'refs/heads/development' }} type=raw,value=latest-windows,enable=${{ github.ref == 'refs/heads/development' }}
type=raw,value=development-latest-windows,enable=${{ gitea.ref == 'refs/heads/development' }} type=raw,value=development-latest-windows,enable=${{ github.ref == 'refs/heads/development' }}
type=raw,value=dev-latest-windows,enable=${{ gitea.ref == 'refs/heads/dev' }} type=raw,value=dev-latest-windows,enable=${{ github.ref == 'refs/heads/dev' }}
type=raw,value=staging-latest-windows,enable=${{ gitea.ref == 'refs/heads/staging' }} type=raw,value=staging-latest-windows,enable=${{ github.ref == 'refs/heads/staging' }}
# Tag with commit sha # Tag with commit sha
type=sha,prefix={{branch}}-windows-,format=short type=sha,prefix={{branch}}-windows-,format=short
# Tag with date # Tag with date
@@ -149,11 +149,11 @@ jobs:
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
registry: ${{ env.REGISTRY }} registry: ${{ env.REGISTRY }}
username: ${{ gitea.actor }} username: alessio
password: ${{ secrets.GITEA_TOKEN }} password: ${{ secrets.GITEA_TOKEN }}
- name: Create and push manifest for main branch - name: Create and push manifest for main branch
if: gitea.ref == 'refs/heads/main' if: github.ref == 'refs/heads/main'
run: | run: |
IMAGE_LOWER=$(echo "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}" | tr '[:upper:]' '[:lower:]') IMAGE_LOWER=$(echo "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}" | tr '[:upper:]' '[:lower:]')
docker buildx imagetools create -t ${IMAGE_LOWER}:latest \ docker buildx imagetools create -t ${IMAGE_LOWER}:latest \
@@ -161,7 +161,7 @@ jobs:
${IMAGE_LOWER}:latest-windows ${IMAGE_LOWER}:latest-windows
- name: Create and push manifest for development branch - name: Create and push manifest for development branch
if: gitea.ref == 'refs/heads/development' if: github.ref == 'refs/heads/development'
run: | run: |
IMAGE_LOWER=$(echo "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}" | tr '[:upper:]' '[:lower:]') IMAGE_LOWER=$(echo "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}" | tr '[:upper:]' '[:lower:]')
docker buildx imagetools create -t ${IMAGE_LOWER}:latest \ docker buildx imagetools create -t ${IMAGE_LOWER}:latest \
@@ -172,7 +172,7 @@ jobs:
${IMAGE_LOWER}:development-latest-windows ${IMAGE_LOWER}:development-latest-windows
- name: Create and push manifest for dev branch - name: Create and push manifest for dev branch
if: gitea.ref == 'refs/heads/dev' if: github.ref == 'refs/heads/dev'
run: | run: |
IMAGE_LOWER=$(echo "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}" | tr '[:upper:]' '[:lower:]') IMAGE_LOWER=$(echo "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}" | tr '[:upper:]' '[:lower:]')
docker buildx imagetools create -t ${IMAGE_LOWER}:dev-latest \ docker buildx imagetools create -t ${IMAGE_LOWER}:dev-latest \
@@ -180,7 +180,7 @@ jobs:
${IMAGE_LOWER}:dev-latest-windows ${IMAGE_LOWER}:dev-latest-windows
- name: Create and push manifest for staging branch - name: Create and push manifest for staging branch
if: gitea.ref == 'refs/heads/staging' if: github.ref == 'refs/heads/staging'
run: | run: |
IMAGE_LOWER=$(echo "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}" | tr '[:upper:]' '[:lower:]') IMAGE_LOWER=$(echo "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}" | tr '[:upper:]' '[:lower:]')
docker buildx imagetools create -t ${IMAGE_LOWER}:staging-latest \ docker buildx imagetools create -t ${IMAGE_LOWER}:staging-latest \