Skip to content

Added github actions and helm chart for testing and deploying app to … #5

Added github actions and helm chart for testing and deploying app to …

Added github actions and helm chart for testing and deploying app to … #5

name: Build and Deploy
on:
push:
branches:
- main
- dev
- pipeline
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build_image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Login to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
outputs:
image_tag: ${{ steps.meta.outputs.tags }}
deploy:
needs: build_image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Authenticate and set context for OpenShift
uses: redhat-actions/oc-login@v1
with:
openshift_server_url: ${{ secrets.OPENSHIFT_SERVER }}
namespace: ${{ github.ref == 'refs/heads/main' && secrets.OPENSHIFT_PROD_NAMESPACE || secrets.OPENSHIFT_DEV_NAMESPACE }}
openshift_token: ${{ github.ref == 'refs/heads/main' && secrets.OPENSHIFT_PROD_TOKEN || secrets.OPENSHIFT_DEV_TOKEN }}
insecure_skip_tls_verify: true
- name: Run Helm
run: |
helm upgrade --install brms-frontend ./helm --values ./helm/values.yaml --set image.tag=${{ needs.build_image.outputs.image_tag }}