name: "Push images on release"
on:
  push:
    tags:
      - v*
jobs:
  build-and-push-image-sriov-cni:
    runs-on: ubuntu-20.04
    env:
      IMAGE_NAME: ghcr.io/${{ github.repository }}
    steps:
      - name: Check out the repo
        uses: actions/checkout@v2

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v1

      - name: Login to Docker
        uses: docker/login-action@v1
        with:
          registry: ghcr.io
          username: ${{ github.repository_owner }}
          password: ${{ secrets.GITHUB_TOKEN }}

      - name: Docker meta
        id: docker_meta
        uses: crazy-max/ghaction-docker-meta@v1
        with:
          images: ${{ env.IMAGE_NAME }}
          tag-latest: false

      - name: Build and push sriov-cni
        uses: docker/build-push-action@v2
        with:
          context: .
          push: true
          tags: |
            ${{ steps.docker_meta.outputs.tags }}
          file: ./Dockerfile
