Update package.json #222
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Push Docker Image | |
| on: | |
| push: | |
| branches: | |
| - traefik-int | |
| paths: | |
| - 'Dockerfile' | |
| - 'go.mod' | |
| - 'go.sum' | |
| - 'main.go' | |
| - 'Makefile' | |
| - '.github/workflows/**' | |
| - 'api/**' | |
| - 'config/**' | |
| - 'database/**' | |
| - 'models/**' | |
| - 'services/**' | |
| - 'ui/**' | |
| workflow_dispatch: | |
| env: | |
| DOCKERHUB_IMAGE_NAME: hhftechnology/middleware-manager | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: Debug trigger | |
| run: | | |
| echo "Event: ${{ github.event_name }}" | |
| echo "Ref: ${{ github.ref }}" | |
| echo "Ref name: ${{ github.ref_name }}" | |
| echo "Branch: ${{ github.ref_type == 'branch' && github.ref_name || 'not a branch' }}" | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to DockerHub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| # Prepare tags based on branch and version | |
| - name: Prepare Docker tags | |
| id: docker_tags | |
| run: | | |
| TAGS="" | |
| if [[ "${{ github.ref_type }}" == "branch" && "${{ github.ref_name }}" == "traefik-int" ]]; then | |
| TAGS="${{ env.DOCKERHUB_IMAGE_NAME }}:traefik-int" | |
| fi | |
| echo "tags=$TAGS" >> $GITHUB_OUTPUT | |
| echo "Docker tags: $TAGS" | |
| - name: Build and push | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: ${{ steps.docker_tags.outputs.tags != '' }} # IMPORTANT: Only push if tags were generated | |
| platforms: linux/amd64,linux/arm64 | |
| tags: ${{ steps.docker_tags.outputs.tags }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |