fixed workflow
This commit is contained in:
@@ -1,17 +1,12 @@
|
|||||||
# .gitea/workflows/build.yaml
|
# .gitea/workflows/build.yaml
|
||||||
name: Build and Push Docker Image
|
name: Build and Push Docker Image
|
||||||
|
|
||||||
# Il workflow viene attivato su push
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- 'main'
|
- 'main'
|
||||||
- 'master'
|
- '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:
|
jobs:
|
||||||
build-and-push:
|
build-and-push:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -19,22 +14,14 @@ jobs:
|
|||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
# Questi due step preparano l'ambiente per build multi-architettura
|
# Log in directly - senza QEMU e Buildx
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v3
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
- name: Log in to Gitea Container Registry
|
- name: Log in to Gitea Container Registry
|
||||||
uses: docker/login-action@v3
|
run: |
|
||||||
with:
|
echo "${{ secrets.GITEA_TOKEN }}" | docker login \
|
||||||
# IMPORTANTE: Sostituisci con il dominio del tuo Gitea (es. gitea.example.com)
|
-u "${{ secrets.GITEA_USERNAME }}" \
|
||||||
registry: gitea.enrilinux.ovh
|
--password-stdin \
|
||||||
username: ${{ secrets.GITEA_USERNAME }}
|
gitea.example.com
|
||||||
password: ${{ secrets.GITEA_TOKEN }}
|
|
||||||
|
|
||||||
# Estrae il nome del repository e il tag (commit SHA) per l'immagine
|
|
||||||
- name: Extract metadata
|
- name: Extract metadata
|
||||||
id: meta
|
id: meta
|
||||||
run: |
|
run: |
|
||||||
@@ -42,12 +29,8 @@ jobs:
|
|||||||
echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
uses: docker/build-push-action@v5
|
run: |
|
||||||
with:
|
docker build -t gitea.example.com/${{ github.repository_owner }}/${{ steps.meta.outputs.REPO_NAME }}:latest .
|
||||||
context: .
|
docker tag gitea.example.com/${{ github.repository_owner }}/${{ steps.meta.outputs.REPO_NAME }}:latest \
|
||||||
push: true
|
gitea.example.com/${{ github.repository_owner }}/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.SHORT_SHA }}
|
||||||
# IMPORTANTE: Sostituisci "gitea.example.com" con il dominio del tuo Gitea
|
docker push gitea.example.com/${{ github.repository_owner }}/${{ steps.meta.outputs.REPO_NAME }} --all-tags
|
||||||
# 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 }}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user