[Fix] Correzione autenticazione Gitea Actions
- 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:
@@ -159,14 +159,19 @@ services:
|
||||
### Principali Differenze
|
||||
|
||||
1. **Context Variables**:
|
||||
- GitHub: `github.*` → Gitea: `gitea.*`
|
||||
- Esempio: `github.actor` → `gitea.actor`
|
||||
- Gitea Actions usa le **stesse variabili** di GitHub Actions: `github.*`
|
||||
- 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)
|
||||
- Gitea non ha un registry pubblico centralizzato come GitHub
|
||||
|
||||
3. **Secret Name**:
|
||||
4. **Secret Name**:
|
||||
- GitHub: `GITHUB_TOKEN` (automatico) → Gitea: `GITEA_TOKEN` (configurato manualmente)
|
||||
|
||||
4. **Attestation**:
|
||||
|
||||
@@ -49,11 +49,11 @@ jobs:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
tags: |
|
||||
# Tag based on branch
|
||||
type=raw,value=latest,enable=${{ gitea.ref == 'refs/heads/main' }}
|
||||
type=raw,value=latest,enable=${{ gitea.ref == 'refs/heads/development' }}
|
||||
type=raw,value=development-latest,enable=${{ gitea.ref == 'refs/heads/development' }}
|
||||
type=raw,value=dev-latest,enable=${{ gitea.ref == 'refs/heads/dev' }}
|
||||
type=raw,value=staging-latest,enable=${{ gitea.ref == 'refs/heads/staging' }}
|
||||
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
|
||||
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/development' }}
|
||||
type=raw,value=development-latest,enable=${{ github.ref == 'refs/heads/development' }}
|
||||
type=raw,value=dev-latest,enable=${{ github.ref == 'refs/heads/dev' }}
|
||||
type=raw,value=staging-latest,enable=${{ github.ref == 'refs/heads/staging' }}
|
||||
# Tag with commit sha
|
||||
type=sha,prefix={{branch}}-,format=short
|
||||
# Tag with date
|
||||
@@ -89,7 +89,7 @@ jobs:
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ gitea.actor }}
|
||||
username: alessio
|
||||
password: ${{ secrets.GITEA_TOKEN }}
|
||||
|
||||
- name: Extract metadata for Docker
|
||||
@@ -99,11 +99,11 @@ jobs:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
tags: |
|
||||
# Tag based on branch with windows suffix
|
||||
type=raw,value=latest-windows,enable=${{ gitea.ref == 'refs/heads/main' }}
|
||||
type=raw,value=latest-windows,enable=${{ gitea.ref == 'refs/heads/development' }}
|
||||
type=raw,value=development-latest-windows,enable=${{ gitea.ref == 'refs/heads/development' }}
|
||||
type=raw,value=dev-latest-windows,enable=${{ gitea.ref == 'refs/heads/dev' }}
|
||||
type=raw,value=staging-latest-windows,enable=${{ gitea.ref == 'refs/heads/staging' }}
|
||||
type=raw,value=latest-windows,enable=${{ github.ref == 'refs/heads/main' }}
|
||||
type=raw,value=latest-windows,enable=${{ github.ref == 'refs/heads/development' }}
|
||||
type=raw,value=development-latest-windows,enable=${{ github.ref == 'refs/heads/development' }}
|
||||
type=raw,value=dev-latest-windows,enable=${{ github.ref == 'refs/heads/dev' }}
|
||||
type=raw,value=staging-latest-windows,enable=${{ github.ref == 'refs/heads/staging' }}
|
||||
# Tag with commit sha
|
||||
type=sha,prefix={{branch}}-windows-,format=short
|
||||
# Tag with date
|
||||
@@ -149,11 +149,11 @@ jobs:
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ gitea.actor }}
|
||||
username: alessio
|
||||
password: ${{ secrets.GITEA_TOKEN }}
|
||||
|
||||
- name: Create and push manifest for main branch
|
||||
if: gitea.ref == 'refs/heads/main'
|
||||
if: github.ref == 'refs/heads/main'
|
||||
run: |
|
||||
IMAGE_LOWER=$(echo "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}" | tr '[:upper:]' '[:lower:]')
|
||||
docker buildx imagetools create -t ${IMAGE_LOWER}:latest \
|
||||
@@ -161,7 +161,7 @@ jobs:
|
||||
${IMAGE_LOWER}:latest-windows
|
||||
|
||||
- name: Create and push manifest for development branch
|
||||
if: gitea.ref == 'refs/heads/development'
|
||||
if: github.ref == 'refs/heads/development'
|
||||
run: |
|
||||
IMAGE_LOWER=$(echo "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}" | tr '[:upper:]' '[:lower:]')
|
||||
docker buildx imagetools create -t ${IMAGE_LOWER}:latest \
|
||||
@@ -172,7 +172,7 @@ jobs:
|
||||
${IMAGE_LOWER}:development-latest-windows
|
||||
|
||||
- name: Create and push manifest for dev branch
|
||||
if: gitea.ref == 'refs/heads/dev'
|
||||
if: github.ref == 'refs/heads/dev'
|
||||
run: |
|
||||
IMAGE_LOWER=$(echo "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}" | tr '[:upper:]' '[:lower:]')
|
||||
docker buildx imagetools create -t ${IMAGE_LOWER}:dev-latest \
|
||||
@@ -180,7 +180,7 @@ jobs:
|
||||
${IMAGE_LOWER}:dev-latest-windows
|
||||
|
||||
- name: Create and push manifest for staging branch
|
||||
if: gitea.ref == 'refs/heads/staging'
|
||||
if: github.ref == 'refs/heads/staging'
|
||||
run: |
|
||||
IMAGE_LOWER=$(echo "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}" | tr '[:upper:]' '[:lower:]')
|
||||
docker buildx imagetools create -t ${IMAGE_LOWER}:staging-latest \
|
||||
|
||||
Reference in New Issue
Block a user