foxy-io 0.3.10

A configuration-driven and hyper-extensible HTTP proxy library
Documentation
name: Publish Docker Workflow

on:
  push:
    tags:
      - "*-docker"

jobs:
  build-and-push:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      packages: write
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Cache Cargo registry & git index
        uses: actions/cache@v4
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: |
            ${{ runner.os }}-cargo-

      - name: Read crate version
        id: crate
        run: |
          version=$(grep -E '^version\s*=' Cargo.toml | head -n1 | cut -d'"' -f2)
          echo "CARGO_VERSION=$version" >> "$GITHUB_ENV"
        shell: bash

      - name: Set up QEMU
        uses: docker/setup-qemu-action@v3

      - name: Set up 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 }}

      - name: Build & push multi-arch image
        uses: docker/build-push-action@v5
        with:
          context: .
          file: ./Dockerfile
          push: true
          platforms: linux/amd64,linux/arm64
          tags: |
            ${{ secrets.DOCKERHUB_USERNAME }}/foxy:latest
            ${{ secrets.DOCKERHUB_USERNAME }}/foxy:${{ env.CARGO_VERSION }}
          cache-from: type=gha,scope=foxy
          cache-to:   type=gha,scope=foxy,mode=max