---
name: Release Images

on:
  push:
    branches:
      - release-0.9
      - release-*

jobs:
  e2e:
    name: E2E
    if: github.repository_owner == 'submariner-io'
    timeout-minutes: 30
    runs-on: ubuntu-latest
    steps:
      - name: Check out the repository
        uses: actions/checkout@v2

      - name: Run E2E deployment and tests
        uses: submariner-io/shipyard/gh-actions/e2e@release-0.9

      - name: Post mortem
        if: failure()
        uses: submariner-io/shipyard/gh-actions/post-mortem@release-0.9

      - name: Clean up E2E deployment
        run: make clean-clusters

  release:
    name: Release Images
    needs: e2e
    runs-on: ubuntu-latest
    steps:
      - name: Check out the repository
        uses: actions/checkout@v2
        with:
          fetch-depth: 0

      - name: Build and release new images
        uses: submariner-io/shipyard/gh-actions/release-images@release-0.9
        with:
          username: ${{ secrets.QUAY_USERNAME }}
          password: ${{ secrets.QUAY_PASSWORD }}
