This repository was archived by the owner on Jul 14, 2026. It is now read-only.
Build and Push OpenShift Image #47
This file contains hidden or 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: Build and Push OpenShift Image | |
| on: | |
| schedule: | |
| - cron: '0 3 * * *' # Nightly at 03:00 UTC | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'Dockerfile.openshift' | |
| - '.github/workflows/build-openshift-image.yml' | |
| pull_request: | |
| paths: | |
| - 'Dockerfile.openshift' | |
| - '.github/workflows/build-openshift-image.yml' | |
| workflow_dispatch: | |
| env: | |
| IMAGE: quay.io/opendatahub/odh-openclaw-rhel9 | |
| jobs: | |
| # PR validation: amd64 only, no push | |
| validate: | |
| if: github.event_name == 'pull_request' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Build (amd64 only) | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| file: ./Dockerfile.openshift | |
| platforms: linux/amd64 | |
| push: false | |
| cache-from: type=gha,scope=openshift-amd64 | |
| cache-to: type=gha,mode=max,scope=openshift-amd64 | |
| # Production build: native runners per platform (no QEMU) | |
| build: | |
| if: github.event_name != 'pull_request' | |
| runs-on: ${{ matrix.runner }} | |
| permissions: | |
| contents: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - platform: linux/amd64 | |
| runner: ubuntu-latest | |
| slug: amd64 | |
| - platform: linux/arm64 | |
| runner: ubuntu-24.04-arm | |
| slug: arm64 | |
| steps: | |
| - name: Checkout upstream source | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: openclaw/openclaw | |
| ref: main | |
| - name: Overlay fork Dockerfile | |
| uses: actions/checkout@v6 | |
| with: | |
| path: fork-overlay | |
| sparse-checkout: Dockerfile.openshift | |
| - name: Copy Dockerfile | |
| run: cp fork-overlay/Dockerfile.openshift . | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Log in to Quay.io | |
| uses: docker/login-action@v4 | |
| with: | |
| registry: quay.io | |
| username: ${{ secrets.QUAY_USERNAME }} | |
| password: ${{ secrets.QUAY_PASSWORD }} | |
| - name: Build and push by digest | |
| id: build | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| file: ./Dockerfile.openshift | |
| platforms: ${{ matrix.platform }} | |
| outputs: type=image,"name=${{ env.IMAGE }}",push-by-digest=true,name-canonical=true,push=true | |
| cache-from: type=gha,scope=openshift-${{ matrix.slug }} | |
| cache-to: type=gha,mode=max,scope=openshift-${{ matrix.slug }} | |
| - name: Export digest | |
| run: | | |
| mkdir -p /tmp/digests | |
| digest="${{ steps.build.outputs.digest }}" | |
| touch "/tmp/digests/${digest#sha256:}" | |
| - name: Upload digest | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: digests-${{ matrix.slug }} | |
| path: /tmp/digests/* | |
| if-no-files-found: error | |
| retention-days: 1 | |
| # Create multi-platform manifest and push tags | |
| merge: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download digests | |
| uses: actions/download-artifact@v8 | |
| with: | |
| path: /tmp/digests | |
| pattern: digests-* | |
| merge-multiple: true | |
| - name: Set image tags | |
| id: tags | |
| run: | | |
| DATE_TAG="$(date -u +%Y%m%d)" | |
| SHA_TAG="${GITHUB_SHA::7}" | |
| TAGS="${IMAGE}:latest,${IMAGE}:${DATE_TAG}-${SHA_TAG}" | |
| if [[ "${{ github.ref }}" == refs/tags/v* ]]; then | |
| TAGS="${TAGS},${IMAGE}:${GITHUB_REF_NAME}" | |
| fi | |
| echo "tags=${TAGS}" >> "$GITHUB_OUTPUT" | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Log in to Quay.io | |
| uses: docker/login-action@v4 | |
| with: | |
| registry: quay.io | |
| username: ${{ secrets.QUAY_USERNAME }} | |
| password: ${{ secrets.QUAY_PASSWORD }} | |
| - name: Create manifest list and push | |
| working-directory: /tmp/digests | |
| run: | | |
| TAGARGS="" | |
| IFS=',' read -ra TAGLIST <<< "${{ steps.tags.outputs.tags }}" | |
| for tag in "${TAGLIST[@]}"; do | |
| TAGARGS="$TAGARGS --tag $tag" | |
| done | |
| docker buildx imagetools create $TAGARGS \ | |
| $(printf "${IMAGE}@sha256:%s " *) |