name: GoPostSubmit

on:
  push:
    branches:
      - main
      - release-*
  workflow_dispatch: {}

env:
  # Common versions
  GO_VERSION: '1.16'
  GO_REQUIRED_MIN_VERSION: ''
  GOPATH: '/home/runner/work/placement/placement/go'
defaults:
  run:
    working-directory: go/src/open-cluster-management.io/placement

jobs:
  verify:
    name: images
    runs-on: ubuntu-latest
    steps:
      - name: checkout code
        uses: actions/checkout@v2
        with:
          fetch-depth: 1
          path: go/src/open-cluster-management.io/placement
      - name: install Go
        uses: actions/setup-go@v2
        with:
          go-version: ${{ env.GO_VERSION }}
      - name: install imagebuilder
        run: go install github.com/openshift/imagebuilder/cmd/imagebuilder@v1.2.1
      - name: images
        run: make images
      - name: push
        run: |
          echo ${{ secrets.DOCKER_PASSWORD }} | docker login quay.io --username ${{ secrets.DOCKER_USER }} --password-stdin
          docker push quay.io/open-cluster-management/placement:latest
