mirror of
https://github.com/redhat-actions/push-to-registry.git
synced 2025-04-20 23:31:22 +00:00
199 lines
6.6 KiB
YAML
199 lines
6.6 KiB
YAML
name: Multiple container CLI build tests
|
|
on:
|
|
push:
|
|
workflow_dispatch:
|
|
schedule:
|
|
- cron: '0 0 * * *' # every day at midnight
|
|
|
|
env:
|
|
IMAGE_NAME: myimage
|
|
IMAGE_TAG: v1
|
|
IMAGE_REGISTRY: quay.io
|
|
|
|
jobs:
|
|
build-only-podman:
|
|
name: Build and push image built only on Podman
|
|
runs-on: ubuntu-20.04
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
install_latest: [ true, false ]
|
|
|
|
|
|
steps:
|
|
- name: Install latest podman
|
|
if: matrix.install_latest
|
|
# https://podman.io/getting-started/installation
|
|
run: |
|
|
. /etc/os-release
|
|
echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/ /" | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
|
|
curl -sSfL "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/Release.key" | sudo apt-key add -
|
|
sudo apt-get update
|
|
sudo apt-get -y upgrade
|
|
sudo apt-get -y install podman
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Build image using Podman
|
|
run: |
|
|
podman build -t ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} -<<EOF
|
|
FROM busybox
|
|
RUN echo "hello world"
|
|
EOF
|
|
|
|
- name: Push image to ${{ env.IMAGE_REGISTRY }}
|
|
id: push
|
|
uses: ./
|
|
with:
|
|
image: ${{ env.IMAGE_NAME }}
|
|
tags: ${{ env.IMAGE_TAG }}
|
|
registry: ${{ env.IMAGE_REGISTRY }}/${{ secrets.REGISTRY_USER }}
|
|
username: ${{ secrets.REGISTRY_USER }}
|
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
|
|
|
- name: Echo outputs
|
|
run: |
|
|
echo "${{ toJSON(steps.push.outputs) }}"
|
|
|
|
build-only-docker:
|
|
name: Build and push image built only on Docker
|
|
runs-on: ubuntu-18.04
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
install_latest: [ true, false ]
|
|
|
|
steps:
|
|
- name: Install latest podman
|
|
if: matrix.install_latest
|
|
# https://podman.io/getting-started/installation
|
|
run: |
|
|
. /etc/os-release
|
|
echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/ /" | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
|
|
curl -sSfL "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/Release.key" | sudo apt-key add -
|
|
sudo apt-get update
|
|
sudo apt-get -y upgrade
|
|
sudo apt-get -y install podman
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Build image using Docker
|
|
run: |
|
|
docker build -t ${{ secrets.REGISTRY_USER }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} -<<EOF
|
|
FROM busybox
|
|
RUN echo "hello world"
|
|
EOF
|
|
|
|
- name: Push image to ${{ env.IMAGE_REGISTRY }}
|
|
id: push
|
|
uses: ./
|
|
with:
|
|
image: ${{ secrets.REGISTRY_USER }}/${{ env.IMAGE_NAME }}
|
|
tags: ${{ env.IMAGE_TAG }}
|
|
registry: ${{ env.IMAGE_REGISTRY }}
|
|
username: ${{ secrets.REGISTRY_USER }}
|
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
|
|
|
- name: Echo outputs
|
|
run: |
|
|
echo "${{ toJSON(steps.push.outputs) }}"
|
|
|
|
build-podman-latest:
|
|
name: Build and push image built latest on Podman
|
|
runs-on: ubuntu-18.04
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
install_latest: [ true, false ]
|
|
|
|
steps:
|
|
- name: Install latest podman
|
|
if: matrix.install_latest
|
|
# https://podman.io/getting-started/installation
|
|
run: |
|
|
. /etc/os-release
|
|
echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/ /" | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
|
|
curl -sSfL "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/Release.key" | sudo apt-key add -
|
|
sudo apt-get update
|
|
sudo apt-get -y upgrade
|
|
sudo apt-get -y install podman
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Build image using Docker
|
|
run: |
|
|
docker build -t ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} -<<EOF
|
|
FROM busybox
|
|
RUN echo "hello world"
|
|
EOF
|
|
|
|
- name: Build image using Podman
|
|
run: |
|
|
podman build -t ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} -<<EOF
|
|
FROM busybox
|
|
RUN echo "hello world"
|
|
EOF
|
|
|
|
- name: Push image to ${{ env.IMAGE_REGISTRY }}
|
|
id: push
|
|
uses: ./
|
|
with:
|
|
image: ${{ env.IMAGE_NAME }}
|
|
tags: ${{ env.IMAGE_TAG }}
|
|
registry: ${{ env.IMAGE_REGISTRY }}/${{ secrets.REGISTRY_USER }}
|
|
username: ${{ secrets.REGISTRY_USER }}
|
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
|
|
|
- name: Echo outputs
|
|
run: |
|
|
echo "${{ toJSON(steps.push.outputs) }}"
|
|
|
|
build-docker-latest:
|
|
name: Build and push image built latest on Docker
|
|
runs-on: ubuntu-18.04
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
install_latest: [ true, false ]
|
|
|
|
steps:
|
|
- name: Install latest podman
|
|
if: matrix.install_latest
|
|
# https://podman.io/getting-started/installation
|
|
run: |
|
|
. /etc/os-release
|
|
echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/ /" | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
|
|
curl -sSfL "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/Release.key" | sudo apt-key add -
|
|
sudo apt-get update
|
|
sudo apt-get -y upgrade
|
|
sudo apt-get -y install podman
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Build image using Podman
|
|
run: |
|
|
podman build -t ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} -<<EOF
|
|
FROM busybox
|
|
RUN echo "hello world"
|
|
EOF
|
|
|
|
- name: Build image using Docker
|
|
run: |
|
|
docker build -t ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} -<<EOF
|
|
FROM busybox
|
|
RUN echo "hello world"
|
|
EOF
|
|
|
|
- name: Push image to ${{ env.IMAGE_REGISTRY }}
|
|
id: push
|
|
uses: ./
|
|
with:
|
|
image: ${{ env.IMAGE_NAME }}
|
|
tags: ${{ env.IMAGE_TAG }}
|
|
registry: ${{ env.IMAGE_REGISTRY }}/${{ secrets.REGISTRY_USER }}
|
|
username: ${{ secrets.REGISTRY_USER }}
|
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
|
|
|
- name: Echo outputs
|
|
run: |
|
|
echo "${{ toJSON(steps.push.outputs) }}"
|