restate-sdk 0.11.0

Restate SDK for Rust
Documentation
name: Build docker image

on:
  push:
    branches: [main, release-**]
    tags:
      - v**
  workflow_dispatch:

env:
  REPOSITORY_OWNER: ${{ github.repository_owner }}
  GHCR_REGISTRY: "ghcr.io"
  GHCR_REGISTRY_USERNAME: ${{ github.actor }}
  GHCR_REGISTRY_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
  build-rust-test-services-docker-image:
    if: github.repository_owner == 'restatedev'
    runs-on: warp-ubuntu-latest-x64-4x
    permissions:
      contents: read
      packages: write
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

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

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v3
        with:
          driver-opts: |
            network=host

      - name: Log into GitHub container registry
        uses: docker/login-action@v3
        with:
          registry: ${{ env.GHCR_REGISTRY }}
          username: ${{ env.GHCR_REGISTRY_USERNAME }}
          password: ${{ env.GHCR_REGISTRY_TOKEN }}

      - name: Extract metadata (tags, labels)
        id: meta
        uses: docker/metadata-action@v5
        with:
          images: |
            ghcr.io/restatedev/test-services-rust
          tags: |
            type=ref,event=branch
            type=semver,pattern={{version}}
            type=semver,pattern={{major}}.{{minor}}

      - name: Build and push docker image
        uses: docker/build-push-action@v6
        with:
          context: .
          file: test-services/Dockerfile
          push: true
          # The integration tests run on x64 runners, so we only need linux/amd64.
          # Cross-building Rust for arm64 under QEMU emulation would be prohibitively slow.
          platforms: linux/amd64
          tags: ${{ steps.meta.outputs.tags }}
          labels: ${{ steps.meta.outputs.labels }}
          cache-from: type=gha,scope=docker-test-services
          cache-to: type=gha,mode=max,scope=docker-test-services