Skip to content

Commit

Permalink
Add publish workflow (vmware-tanzu#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmontleon committed Jul 8, 2021
1 parent 92d0004 commit f87b779
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/publish.yml
@@ -0,0 +1,61 @@
name: Publish Images

on:
push:
branches:
- konveyor-dev
- 'release-*.*.*'
- 'sprint-*'
tags:
- 'release-*.*.*'
workflow_dispatch:

env:
REGISTRY: quay.io
IMAGE_NAME: konveyor/velero
HELPER_IMAGE_NAME: konveyor/velero-restic-restore-helper
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.ubi --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.extract_branch.outputs.branch }}

- name: Build helper image
run: docker build . --file Dockerfile-velero-restic-restore-helper.ubi --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: Push helper image
run: docker push ${{ env.REGISTRY }}/${{ env.HELPER_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/konveyor-dev' }}

- name: Retag helper image
run: docker tag ${{ env.REGISTRY }}/${{ env.HELPER_IMAGE_NAME }}:${{ steps.extract_branch.outputs.branch }} ${{ env.REGISTRY }}/${{ env.HELPER_IMAGE_NAME }}:latest
if: ${{ github.ref == 'refs/heads/konveyor-dev' }}

- name: push retagged container image
run: docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
if: ${{ github.ref == 'refs/heads/konveyor-dev' }}

- name: push retagged helper image
run: docker push ${{ env.REGISTRY }}/${{ env.HELPER_IMAGE_NAME }}:latest
if: ${{ github.ref == 'refs/heads/konveyor-dev' }}

0 comments on commit f87b779

Please sign in to comment.