name: Build and Push Image
on:
  release:
    types:
    - published
  pull_request:
    paths-ignore:
    - '.circleci/**'
    - 'docs/**'
    - 'test/**'

jobs:
  build:
    name: Build and Push Image
    runs-on: ubuntu-20.04

    steps:
    - uses: actions/checkout@v2

    - name: Build Image
      id: buildah-build
      uses: redhat-actions/buildah-build@v2
      with:
        image: bioconda/bioconda-utils-build-env
        tags: >-
          latest
          ${{ github.event.release && github.event.release.tag_name || github.sha }}
        dockerfiles: |
          ./Dockerfile

    - name: Test Built Image
      run: |
        image='${{ steps.buildah-build.outputs.image }}'
        for tag in ${{ steps.buildah-build.outputs.tags }} ; do
          podman run --rm "${image}:${tag}" bioconda-utils --version
        done

    - if: ${{ github.event.release }}
      name: Push To Quay
      uses: redhat-actions/push-to-registry@v2
      with:
        image: ${{ steps.buildah-build.outputs.image }}
        tags: ${{ steps.buildah-build.outputs.tags }}
        registry: ${{ secrets.QUAY_BIOCONDA_REPO }}
        username: ${{ secrets.QUAY_BIOCONDA_USERNAME }}
        password: ${{ secrets.QUAY_BIOCONDA_TOKEN }}

name: Build and Push Image
on:
  release:
    types:
    - published
  pull_request:
    paths-ignore:
    - '.circleci/**'
    - 'docs/**'
    - 'test/**'

jobs:
  build:
    name: Build and Push Image
    runs-on: ubuntu-20.04

    steps:
    - uses: actions/checkout@v2

    - name: Build Image
      id: buildah-build
      uses: redhat-actions/buildah-build@v2
      with:
        image: bioconda-utils-build-env
        tags: >-
          latest
          ${{ github.event.release && github.event.release.tag_name || github.sha }}
        dockerfiles: |
          ./Dockerfile

    - name: Test Built Image
      run: |
        image='${{ steps.buildah-build.outputs.image }}'
        for tag in ${{ steps.buildah-build.outputs.tags }} ; do
          podman run --rm "${image}:${tag}" bioconda-utils --version
        done

    - if: ${{ github.event.release }}
      name: Push To Quay
      uses: redhat-actions/push-to-registry@v2
      with:
        image: ${{ steps.buildah-build.outputs.image }}
        tags: ${{ steps.buildah-build.outputs.tags }}
        registry: ${{ secrets.QUAY_BIOCONDA_REPO }}
        username: ${{ secrets.QUAY_BIOCONDA_USERNAME }}
        password: ${{ secrets.QUAY_BIOCONDA_TOKEN }}

Remove superfluous bioconda/ from container tag
CI/CD: Remove superfluous bioconda/ from container tag
