diff --git a/.gitea/workflows/publish-package.yml b/.gitea/workflows/publish-package.yml index de7070d..bb01d89 100644 --- a/.gitea/workflows/publish-package.yml +++ b/.gitea/workflows/publish-package.yml @@ -1,17 +1,12 @@ # .gitea/workflows/build.yaml name: Build and Push Docker Image -# Il workflow viene attivato su push on: push: branches: - 'main' - 'master' -# Questa sezione è fondamentale per evitare build quando non necessario -# Gitea ignorerà automaticamente i commit che contengono queste stringhe [citation:10] -# Aggiungi "[skip ci]" al tuo messaggio di commit per saltare la build - jobs: build-and-push: runs-on: ubuntu-latest @@ -19,22 +14,14 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - # Questi due step preparano l'ambiente per build multi-architettura - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - + # Log in directly - senza QEMU e Buildx - name: Log in to Gitea Container Registry - uses: docker/login-action@v3 - with: - # IMPORTANTE: Sostituisci con il dominio del tuo Gitea (es. gitea.example.com) - registry: gitea.enrilinux.ovh - username: ${{ secrets.GITEA_USERNAME }} - password: ${{ secrets.GITEA_TOKEN }} + run: | + echo "${{ secrets.GITEA_TOKEN }}" | docker login \ + -u "${{ secrets.GITEA_USERNAME }}" \ + --password-stdin \ + gitea.example.com - # Estrae il nome del repository e il tag (commit SHA) per l'immagine - name: Extract metadata id: meta run: | @@ -42,12 +29,8 @@ jobs: echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - name: Build and push Docker image - uses: docker/build-push-action@v5 - with: - context: . - push: true - # IMPORTANTE: Sostituisci "gitea.example.com" con il dominio del tuo Gitea - # e "username" con il tuo nome utente o organizzazione - tags: | - gitea.enrilinux.ovh/${{ github.repository_owner }}/${{ steps.meta.outputs.REPO_NAME }}:latest - gitea.enrilinux.ovh/${{ github.repository_owner }}/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.SHORT_SHA }} + run: | + docker build -t gitea.example.com/${{ github.repository_owner }}/${{ steps.meta.outputs.REPO_NAME }}:latest . + docker tag gitea.example.com/${{ github.repository_owner }}/${{ steps.meta.outputs.REPO_NAME }}:latest \ + gitea.example.com/${{ github.repository_owner }}/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.SHORT_SHA }} + docker push gitea.example.com/${{ github.repository_owner }}/${{ steps.meta.outputs.REPO_NAME }} --all-tags