Skip to content

Updated github actions build and deploy to dev #1

Updated github actions build and deploy to dev

Updated github actions build and deploy to dev #1

name: Build and Deploy to Dev
on:
push:
branches:
- main
- dev
- test
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build_and_push:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image to OpenShift
uses: docker/build-push-action@v5
with:
context: ./frontend
push: true
tags: ${{ github.sha }}
labels: ${{ github.sha }}
deploy:
needs: build_and_push
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Install oc
uses: redhat-actions/openshift-tools-installer@v1
with:
oc: 4
- name: Authenticate with OpenShift
uses: redhat-actions/oc-login@v1
with:
openshift_server_url: ${{ secrets.OPENSHIFT_SERVER }}
namespace: ${{ secrets.OPENSHIFT_DEV_NAMESPACE }}
openshift_token: ${{ secrets.OPENSHIFT_TOKEN }}
insecure_skip_tls_verify: true
- name: Deploy with Helm
run: |
helm upgrade --install "landingpage" ./frontend/helm \
--set image.repository=${{ secrets.OPENSHIFT_REGISTRY_URL }}/${{ secrets.OPENSHIFT_DEV_NAMESPACE }}/landingpage \
--set image.tag= ${{ github.sha }}
--namespace ${{ secrets.OPENSHIFT_DEV_NAMESPACE }}