# Maintained in https://github.com/coreos/repo-templates
# Do not edit downstream.

name: Container

on:
  push:
    branches: [main]
    tags: ["v*"]
  pull_request:
    branches: [main]

permissions:
  contents: read

# avoid races when pushing containers built from main
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}

jobs:
  build-container:
    name: Build container image
    runs-on: ubuntu-latest
    steps:
      - name: Check out repository
        uses: actions/checkout@v5
        with:
          # fetch tags so the compiled-in version number is useful
          fetch-depth: 0
      # If we're running on a signed tag, actions/checkout rewrites it into
      # a lightweight tag (!!!) which "git describe" then ignores.  Rewrite
      # it back.
      # https://github.com/actions/checkout/issues/290
      - name: Fix actions/checkout synthetic tag
        run: git fetch --tags --force
      - name: Build and push container
        uses: coreos/actions-lib/build-container@main
        with:
          credentials: ${{ secrets.QUAY_AUTH }}
          file: Dockerfile.validate
          push: quay.io/coreos/ignition-validate
          arches: amd64 arm64
          # Speed up PR CI by skipping non-amd64
          pr-arches: amd64
