diff --git a/.gitea/workflows/gitea-ci.yaml b/.gitea/workflows/gitea-ci.yaml index 31b5aa9..2baf571 100644 --- a/.gitea/workflows/gitea-ci.yaml +++ b/.gitea/workflows/gitea-ci.yaml @@ -3,11 +3,13 @@ # name: Build And Test -run-name: ${{ gitea.actor }} is runs ci pipeline +run-name: ${{ gitea.actor }} started ci pipeline on: push: branches: - main + tags: + - 'v*' # Tags, die mit "v" anfangen, z. B. v1.0.0 workflow_dispatch: jobs: build: @@ -24,11 +26,12 @@ jobs: publish: needs: build + name: Build and Publish Docker Image runs-on: ubuntu-latest if: gitea.ref == 'refs/heads/main' steps: - uses: https://github.com/actions/checkout@v6 - + - name: Docker login to Docker Hub run: | echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login docker.io \ @@ -48,10 +51,19 @@ jobs: [registry."git.hnrx.net"] username = "${{ secrets.DOCKER_USERNAME }}" password = "${{ secrets.DOCKER_PASSWORD }}" - - name: Build and Push Docker Image + - name: Build and Push Docker latest Image uses: docker/build-push-action@v6 with: context: . push: true - tags: git.hnrx.net/homelab/manage-servers:latest + tags: git.hnrx.net/hnrx/manage-servers:latest + file: ./Dockerfile + + - name: Build and Push Docker versioned Image ${{ gitea.ref_name }} + if: startsWith(gitea.ref, 'refs/tags/v') && (gitea.ref_name =~ '^v[0-9]+\.[0-9]+\.[0-9]+$') + uses: docker/build-push-action@v6 + with: + context: . + push: true + tags: git.hnrx.net/hnrx/manage-servers:${{ gitea.ref_name }} file: ./Dockerfile \ No newline at end of file