Skip to content

Commit a4d6331

Browse files
committed
Add publish workflow
1 parent 92d0004 commit a4d6331

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

.github/workflows/publish.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Publish Images
2+
3+
on:
4+
push:
5+
branches:
6+
- konveyor-dev
7+
- 'release-*.*.*'
8+
- 'sprint-*'
9+
tags:
10+
- 'release-*.*.*'
11+
workflow_dispatch:
12+
13+
env:
14+
REGISTRY: quay.io
15+
IMAGE_NAME: konveyor/velero
16+
HELPER_IMAGE_NAME: konveyor/velero-restic-restore-helper
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: read
22+
packages: write
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v2
26+
27+
- name: Extract branch name
28+
shell: bash
29+
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
30+
id: extract_branch
31+
32+
- name: Build container image
33+
run: docker build . --file Dockerfile.ubi --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.extract_branch.outputs.branch }}
34+
35+
- name: Build helper image
36+
run: docker build . --file Dockerfile-velero-restic-restore-helper.ubi --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.extract_branch.outputs.branch }}
37+
38+
- name: Log into registry
39+
run: echo "${{ secrets.QUAY_PUBLISH_TOKEN }}" | docker login quay.io -u ${{ secrets.QUAY_PUBLISH_ROBOT }} --password-stdin
40+
41+
- name: Push container image
42+
run: docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.extract_branch.outputs.branch }}
43+
44+
- name: Push helper image
45+
run: docker push ${{ env.REGISTRY }}/${{ env.HELPER_IMAGE_NAME }}:${{ steps.extract_branch.outputs.branch }}
46+
47+
- name: Retag container image
48+
run: docker tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.extract_branch.outputs.branch }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
49+
if: ${{ github.ref == 'refs/heads/konveyor-dev' }}
50+
51+
- name: Retag helper image
52+
run: docker tag ${{ env.REGISTRY }}/${{ env.HELPER_IMAGE_NAME }}:${{ steps.extract_branch.outputs.branch }} ${{ env.REGISTRY }}/${{ env.HELPER_IMAGE_NAME }}:latest
53+
if: ${{ github.ref == 'refs/heads/konveyor-dev' }}
54+
55+
- name: push retagged container image
56+
run: docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
57+
if: ${{ github.ref == 'refs/heads/konveyor-dev' }}
58+
59+
- name: push retagged helper image
60+
run: docker push ${{ env.REGISTRY }}/${{ env.HELPER_IMAGE_NAME }}:latest
61+
if: ${{ github.ref == 'refs/heads/konveyor-dev' }}

0 commit comments

Comments
 (0)