From 3f20a968afa1a916c3ff87bf5000506abf2c70f6 Mon Sep 17 00:00:00 2001 From: Yassine Sallemi Date: Fri, 20 Sep 2024 17:00:52 +0100 Subject: [PATCH] feat: merge workflow optimized --- .github/workflows/merge.yml | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index 56281097..3b8258a2 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -1,8 +1,8 @@ -name: Build and Push Docker Image On Merge +name: Build and Push Docker Images On Merge on: push: - branches: ['main'] + branches: ["main"] workflow_dispatch: jobs: @@ -12,6 +12,7 @@ jobs: frontend: ${{ steps.filter.outputs.frontend }} api: ${{ steps.filter.outputs.api }} widget: ${{ steps.filter.outputs.widget }} + nlu: ${{ steps.filter.outputs.nlu }} steps: - uses: actions/checkout@v4 - name: Filter paths @@ -25,6 +26,8 @@ jobs: - 'api/**' widget: - 'widget/**' + nlu: + - 'nlu/**' build-and-push: runs-on: ubuntu-latest @@ -39,7 +42,7 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - + - name: Login to Docker Hub id: docker_login uses: docker/login-action@v2 @@ -47,7 +50,7 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push frontend Docker image + - name: Build and push Frontend Docker image if: ${{ needs.paths-filter.outputs.frontend == 'true' }} uses: docker/build-push-action@v6 with: @@ -55,24 +58,34 @@ jobs: file: ./frontend/Dockerfile platforms: linux/amd64,linux/arm64 push: true - tags: ${{ secrets.DOCKERHUB_USERNAME }}/hexabot-frontend:latest + tags: hexastack/hexabot-ui:latest - name: Build and push API Docker image if: ${{ needs.paths-filter.outputs.api == 'true' }} uses: docker/build-push-action@v6 with: - context: ./ + context: ./api/ file: ./api/Dockerfile platforms: linux/amd64,linux/arm64 push: true - tags: ${{ secrets.DOCKERHUB_USERNAME }}/hexabot-api:latest + tags: hexastack/hexabot-api:latest - - name: Build and push widget Docker image + - name: Build and push Widget Docker image if: ${{ needs.paths-filter.outputs.widget == 'true' }} uses: docker/build-push-action@v6 with: - context: ./ + context: ./widget/ file: ./widget/Dockerfile platforms: linux/amd64,linux/arm64 push: true - tags: ${{ secrets.DOCKERHUB_USERNAME }}/hexabot-widget:latest + tags: hexastack/hexabot-widget:latest + + - name: Build and push NLU Docker image + if: ${{ needs.paths-filter.outputs.nlu == 'true' }} + uses: docker/build-push-action@v6 + with: + context: ./nlu/ + file: ./nlu/Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: hexastack/hexabot-nlu:latest