Merge pull request #89 from ambient-code/revert-88-token_login_change #6
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 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 | |
| - 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 }} | |
| 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 }} | |
| 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 project ambient-code | |
| oc delete po --all |