mirror of
https://github.com/redhat-actions/push-to-registry.git
synced 2025-04-20 06:36:17 +02:00
49 lines
1.5 KiB
YAML
49 lines
1.5 KiB
YAML
# 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 Build and Push
|
|
on: [ push, workflow_dispatch ]
|
|
env:
|
|
IMAGE_NAME: myimage
|
|
IMAGE_REGISTRY: quay.io
|
|
IMAGE_TAGS: v1 ${{ github.sha }}
|
|
|
|
jobs:
|
|
build:
|
|
name: Push image to Quay.io
|
|
runs-on: ubuntu-20.04
|
|
steps:
|
|
# Checkout push-to-registry action github repository
|
|
- name: Checkout Push to Registry action
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Build Image using Docker
|
|
run: |
|
|
docker build -t ${{ env.IMAGE_NAME }}:v1 -<<EOF
|
|
FROM busybox
|
|
RUN echo "hello world"
|
|
EOF
|
|
|
|
- name: Build Image using Podman
|
|
run: |
|
|
podman build -t ${{ env.IMAGE_NAME }}:v1 -<<EOF
|
|
FROM busybox
|
|
RUN echo "hello world"
|
|
EOF
|
|
podman tag ${{ env.IMAGE_NAME }}:v1 ${{ env.IMAGE_NAME }}:${{ github.sha }}
|
|
|
|
# Push the image to image registry
|
|
- name: Push To Quay
|
|
uses: ./
|
|
id: push
|
|
with:
|
|
image: ${{ env.IMAGE_NAME }}
|
|
tags: ${{ env.IMAGE_TAGS }}
|
|
registry: ${{ env.IMAGE_REGISTRY }}/${{ secrets.REGISTRY_USER }}
|
|
username: ${{ secrets.REGISTRY_USER }}
|
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
|
|
|
- name: Echo outputs
|
|
run: |
|
|
echo "Digest: ${{ steps.push.outputs.digest }}"
|
|
echo "Registry Paths: ${{ steps.push.outputs.registry-paths }}"
|