Skip to content

publish

publish #74

Workflow file for this run

---
name: publish
on:
schedule:
- cron: '0 10 * * *' # everyday at 10am
push:
branches:
- main
tags:
- 'v*'
pull_request:
branches:
- main
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
IMAGE_PATH: ${{ vars.REGISTRY_URI }}/${{ vars.REGISTRY_REPOSITORY }}/ee-kube-hub-init-tools
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
# Modified from: https://github.com/redhat-actions/buildah-build/issues/121#issuecomment-1683691170
jobs:
build-ee:
name: Build EE
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/arm64
steps:
- name: Checkout πŸ›ŽοΈ
uses: actions/checkout@v4
- name: Install ansible-builder 🧰
run: pip install ansible-builder
- name: Crate Ansible EE container image context πŸ› 
run: ansible-builder create -v3
- name: Extract architecture name from platform name πŸ”Ž
run: |
echo "PODMAN_ARCH=${PLATFORM#*/}" >>${GITHUB_ENV}
env:
PLATFORM: ${{ matrix.platform }}
- name: Create container image build meta ℹ️
id: build-meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.IMAGE_PATH }}
tags: |
type=raw,value=build
flavor: |
suffix=-${{ env.PODMAN_ARCH }}
- name: Set up QEMU 🧰
uses: docker/setup-qemu-action@v3
- name: Build OCI Image πŸ› οΈ
id: build-image
uses: redhat-actions/buildah-build@v2
with:
tags: ${{ steps.build-meta.outputs.tags }}
labels: ${{ steps.build-meta.outputs.labels }}
oci: true
context: ./context
containerfiles: |
./context/Containerfile
platforms: ${{ matrix.platform }}
- name: Export OCI archives πŸ’Ύ
run: skopeo copy containers-storage:${{ env.IMAGE_PATH }}:build-${{ env.PODMAN_ARCH }} oci-archive:/tmp/${{ env.PODMAN_ARCH }}-oci.tar
- name: Upload OCI archives πŸ”Ί
uses: actions/upload-artifact@v4
with:
name: build-${{ env.PODMAN_ARCH }}
path: /tmp/${{ env.PODMAN_ARCH }}-oci.tar
if-no-files-found: error
retention-days: 1
publish-ee:
name: Publish EE
runs-on: ubuntu-latest
needs: build-ee
steps:
- name: Download OCI archives πŸ”»
uses: actions/download-artifact@v4
with:
pattern: build-*
path: oci-archives
merge-multiple: true
- name: Create manifest πŸ“’
run: podman manifest create ${{ env.IMAGE_PATH }}:manifest
- name: Add platform specific images to manifest βž•
run: |
for OCI_TAR in oci-archives/*-oci.tar; do
podman manifest add ${{ env.IMAGE_PATH }}:manifest oci-archive:${OCI_TAR}
done
- name: Create container image build meta ℹ️
id: push-meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.IMAGE_PATH }}
tags: |
type=schedule,pattern=nightly
type=edge,branch=main
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Tag multi platform manifest 🏷
run: |
podman tag ${{ env.IMAGE_PATH }}:manifest $(echo "${{ steps.push-meta.outputs.tags }}" | tr '\n' ' ')
- name: Publish images πŸ“°
id: publish-images
uses: redhat-actions/push-to-registry@v2
with:
tags: ${{ steps.push-meta.outputs.tags }}
username: ${{ env.REGISTRY_USERNAME }}
password: ${{ env.REGISTRY_PASSWORD }}
- name: Pushed Image Digest πŸ”–
run: echo ${{ steps.publish-images.outputs.digest }}
- name: Pushed Image Registry Paths πŸ”–
run: echo ${{ steps.publish-images.outputs.registry-paths }}