name: release-containers
on:
  release:
    types:
      - "published"

permissions:
  packages: write
  id-token: write
  attestations: write

jobs:
  publish-container-images:
    name: publish-container-images
    runs-on: ubuntu-latest
    # Covered by `release-nightly.yaml`
    if: ${{ github.event.release.tag_name != 'nightly' }}
    strategy:
      matrix:
        base-image:
          - scratch
          - erlang
          - erlang-slim
          - erlang-alpine
          - elixir
          - elixir-slim
          - elixir-alpine
          - node
          - node-slim
          - node-alpine

    steps:
      - name: Checkout repository
        uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
        with:
          sparse-checkout: |
            .github/actions
            containers
          persist-credentials: false

      - name: "Build & Push Container"
        uses: "./.github/actions/build-container"
        with:
          release-id: ${{ github.event.release.id }}
          version: ${{ github.ref_name }}
