---
name: Container Build

on:
  push:
    tags: ['[0-9]+.[0-9]+.[0-9]+']

jobs:
  build:
    name: build
    runs-on: ubuntu-latest
    permissions:
      contents: read
      packages: write
    steps:
      - uses: actions/checkout@v2
      - uses: docker/setup-qemu-action@v1
      - uses: docker/setup-buildx-action@v1
      - uses: docker/login-action@v1
        with:
          registry: ghcr.io
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}
      - id: version
        run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
      - uses: docker/build-push-action@v2
        with:
          platforms: linux/amd64, linux/arm64
          push: true
          tags: |-
            ghcr.io/${{ github.repository }}:latest
            ghcr.io/${{ github.repository }}:${{ steps.version.outputs.VERSION }}
