name: release

on:
  push:
    branches:
      - master

jobs:
  release:
    runs-on: ubuntu-latest
    container:
      image: gitea/runner-images:ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Set up Docker BuildX
        uses: docker/setup-buildx-action@v3
        with:
          buildkitd-flags: --debug

      - name: Login to DockerHub
        uses: docker/login-action@v3
        with:
          username: ${{ secrets.DOCKER_USERNAME }}
          password: ${{ secrets.DOCKER_PASSWORD }}

      - name: Build and push default 22.04
        uses: docker/build-push-action@v6
        with:
          context: .
          file: Dockerfile
          platforms: linux/arm64
          pull: true
          push: true
          no-cache: true
          build-args: |
            BASE_IMAGE_TAG=ubuntu-22.04
            IMAGE_VERSION=${{ steps.meta.outputs.IMAGE_VERSION }}
            IMAGE_CREATED=${{ steps.meta.outputs.IMAGE_CREATED }}
            IMAGE_REVISION=${{ steps.meta.outputs.IMAGE_REVISION }}
          tags: |
            seeseemelk/runner-images:ubuntu-22.04
            seeseemelk/runner-images:ubuntu-22.04-${{ steps.meta.outputs.IMAGE_VERSION }}
            seeseemelk/runner-images:ubuntu-latest