Skip to content

fixing the runners to run #70

fixing the runners to run

fixing the runners to run #70

name: Build and Push Component Docker Images
on:
push:
branches: [main]
pull_request_target:
branches: [main]
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
issues: read
id-token: write
strategy:
matrix:
component:
- name: frontend
context: ./components/frontend
image: quay.io/ambient_code/vteam_frontend
- name: backend
context: ./components/backend
image: quay.io/ambient_code/vteam_backend
- name: operator
context: ./components/operator
image: quay.io/ambient_code/vteam_operator
- name: claude-code-runner
context: ./components/runners/claude-code-runner
image: quay.io/ambient_code/vteam_claude_runner
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64,linux/arm64
- name: Log in to Quay.io
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Log in to Red Hat Container Registry
uses: docker/login-action@v3
with:
registry: registry.redhat.io
username: ${{ secrets.REDHAT_USERNAME }}
password: ${{ secrets.REDHAT_PASSWORD }}
- name: Build and push ${{ matrix.component.name }} image only for merge into main
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: docker/build-push-action@v6
with:
context: ${{ matrix.component.context }}
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ matrix.component.image }}:latest
${{ matrix.component.image }}:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build ${{ matrix.component.name }} image for pull requests but don't push
if: github.event_name == 'pull_request_target'
uses: docker/build-push-action@v6
with:
context: ${{ matrix.component.context }}
platforms: linux/amd64,linux/arm64
push: false
tags: ${{ matrix.component.image }}:pr-${{ github.event.pull_request.number }}
cache-from: type=gha
cache-to: type=gha,mode=max
deploy-to-openshift:
runs-on: ubuntu-latest
needs: build-and-push
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install oc
uses: redhat-actions/oc-installer@v1
with:
oc_version: 'latest'
- name: Log in to OpenShift Cluster
run: |
oc login ${{ secrets.OPENSHIFT_SERVER }} --token=${{ secrets.OPENSHIFT_TOKEN }} --insecure-skip-tls-verify
- name: Deploy updated components to OpenShift
run: |
oc delete po --all -n ambient-code