publish #79
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
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 }} |