Add feature to push multiple tags of the image

Signed-off-by: divyansh42 <diagrawa@redhat.com>
This commit is contained in:
divyansh42 2021-01-25 15:52:13 +05:30
parent 23eb62f550
commit 73da53f4a0
6 changed files with 96 additions and 55 deletions

View file

@ -1,7 +1,7 @@
# This workflow will perform a test whenever there
# is some change in code done to ensure that the changes
# are not buggy and we are getting the desired output.
name: Test Push without image
name: Test Build and Push
on: [ push, workflow_dispatch ]
env:
IMAGE_NAME: myimage
@ -19,10 +19,13 @@ jobs:
- name: Build Image using Docker
run: |
docker build -t ${{ env.IMAGE_NAME }}:latest -<<EOF
docker build -t ${{ env.IMAGE_NAME }}:v1 -<<EOF
FROM busybox
RUN echo "hello world"
EOF
docker tag ${{ env.IMAGE_NAME }}:v1 ${{ env.IMAGE_NAME }}:v2
docker tag ${{ env.IMAGE_NAME }}:v1 ${{ env.IMAGE_NAME }}:v3
# Push the image to image registry
- name: Push To Quay
@ -30,12 +33,12 @@ jobs:
id: push
with:
image: ${{ env.IMAGE_NAME }}
tag: ${{ env.IMAGE_TAG }}
tags: v1 v2 v3
registry: ${{ env.IMAGE_REGISTRY }}/${{ secrets.REGISTRY_USER }}
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Echo outputs
run: |
echo "registry-path ${{ steps.push.outputs.registry-path }}"
echo "digest ${{ steps.push.outputs.digest }}"
echo "Digest: ${{ steps.push.outputs.digest }}"
echo "Registry Paths: ${{ steps.push.outputs.registry-paths }}"