MailLaser 2.0.0

An SMTP server that listens for incoming emails addressed to a specific recipient and forwards them as HTTP POST requests to a configured webhook.
Documentation
# This workflow builds and pushes a Docker image when a semver tag is pushed.

name: Docker Publish

on:
  push:
    tags:
      - 'v*.*.*' # Trigger on semantic version tags (e.g., v1.0.0)

jobs:
  build-and-push:
    name: Build and Push Docker Image
    runs-on: ubuntu-latest
    # Permissions needed to push to GHCR. May not be needed for Docker Hub depending on setup.
    permissions:
      contents: read
      packages: write

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Set up Docker Buildx
        id: buildx
        uses: docker/setup-buildx-action@v3
        with:
          install: true # Ensure buildx is installed


      # --- Log in to GitHub Container Registry (GHCR) ---
      - name: Log in to GitHub Container Registry
        uses: docker/login-action@v3
        with:
          registry: ghcr.io
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}

      - name: Extract metadata (tags, labels) for Docker
        id: meta
        uses: docker/metadata-action@v5
        with:
          # Replace with your image name on Docker Hub or GHCR
          # Example GHCR: ghcr.io/your-org/mail-laser
          images: |
            ghcr.io/${{ github.repository_owner }}/mail-laser
          tags: |
            # Create tags based on the semver git tag
            type=semver,pattern={{version}} # e.g., v1.2.3 -> 1.2.3
            type=semver,pattern={{major}}.{{minor}} # e.g., v1.2.3 -> 1.2
            type=semver,pattern={{major}} # e.g., v1.2.3 -> 1
            # Add 'latest' tag only for semver tags
            type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }}

      - name: Build and push Docker image
        id: build-push
        uses: docker/build-push-action@v6
        with:
          context: .
          file: ./Dockerfile
          push: true
          tags: ${{ steps.meta.outputs.tags }}
          labels: ${{ steps.meta.outputs.labels }}
          # Enable GitHub Actions cache for Docker layers
          cache-from: type=gha
          cache-to: type=gha,mode=max
          # Ensure platform is set for potentially cross-platform builds if needed later
          # platforms: linux/amd64 # Add other platforms like linux/arm64 if required