Merge pull request #28 from migtools/konflux/references/master #44
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Images | |
on: | |
push: | |
branches: | |
- master | |
- 'release-*.*.*' | |
- 'sprint-*' | |
tags: | |
- 'release-*.*.*' | |
workflow_dispatch: | |
env: | |
REGISTRY: quay.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Extract branch name | |
shell: bash | |
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" | |
id: extract_branch | |
- name: Build container image | |
run: docker build . --file Dockerfile --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.extract_branch.outputs.branch }} | |
- name: Log into registry | |
run: echo "${{ secrets.QUAY_PUBLISH_TOKEN }}" | docker login quay.io -u ${{ secrets.QUAY_PUBLISH_ROBOT }} --password-stdin | |
- name: Push container image | |
run: docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.extract_branch.outputs.branch }} | |
- name: Retag container image | |
run: docker tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.extract_branch.outputs.branch }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest | |
if: ${{ github.ref == 'refs/heads/master' }} | |
- name: push retagged container image | |
run: docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest | |
if: ${{ github.ref == 'refs/heads/master' }} |