MYHOSPITALNOW.COM

Find Trusted Doctors & Hospitals

Discover healthcare providers, compare hospitals, and explore treatment options worldwide.

Free Treatment Quotes • Doctor Search • Hospital Comparison

Find Healthcare Options

www.myhospitalnow.com

Github Actions Pipeline for openshift deployment

Use Case

Write a github action job which would build an image and then publish to ghcr. Upon Successful publishing, trigger a openshift deployment


name: OpenShift Deployment

on:
push:
branches:
– main

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
  uses: actions/checkout@v2

- name: Build Docker image
  run: docker build -t my-image:latest .

- name: Log in to Docker registry
  run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Push Docker image to GHCR
  run: docker push ghcr.io/${{ github.repository_owner }}/my-image:latest

- name: Set up OpenShift CLI
  uses: redhat-actions/oc-login@v1
  with:
    openshift_server_url: ${{ secrets.OPENSHIFT_SERVER_URL }}
    openshift_token: ${{ secrets.OPENSHIFT_TOKEN }}

- name: Trigger OpenShift deployment
  run: |
    oc project my-project
    oc rollout latest deployment/my-deploymentCode language: JavaScript (javascript)

To use this workflow, you need to set up the following secrets in your GitHub repository:

  • OPENSHIFT_SERVER_URL: The URL of your OpenShift server.
  • OPENSHIFT_TOKEN: An authentication token to access your OpenShift cluster.

Make sure to replace my-image, my-project, and my-deployment with your own image, project, and deployment names.

This workflow listens for pushes to the main branch. When a push event occurs, it checks out the repository, builds a Docker image, logs in to GHCR using the provided GITHUB_TOKEN, pushes the image to GHCR, sets up the OpenShift CLI using the provided secrets, and finally triggers an OpenShift deployment by rolling out the latest changes to the specified deployment.

Ensure that your GitHub Actions runner has the necessary access permissions to push the Docker image to GHCR and trigger the OpenShift deployment.

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services โ€” all in one place.

Explore Hospitals
I'm Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms. I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.

Related Posts

Best GitHub Advanced Security Alternatives for DevSecOps Teams

GitHub Advanced Security is convenient when repositories, reviews and security policies already live in GitHub. The purchasing question becomes harder when a team wants broader coverage, operates…

Read More

What Is GitHub Actions Runner Controller?

GitHub Actions is a CI/CD platform that automates tasks such as building applications, running tests, creating Docker images, and deploying software. Every GitHub Actions job requires a…

Read More

Complete Tutorial: Use Two GitHub Accounts on One Mac with SSH

This tutorial explains how to configure two GitHub accounts on the same MacBook using separate SSH keys, without repeatedly switching accounts or breaking your existing Git configuration….

Read More

How to Install GitHub CLI (gh) on macOS, Windows, and Linux: Complete Step-by-Step Guide

SEO Title: How to Install GitHub CLI (gh) on Mac, Windows & Linux โ€“ 2026 Guide Meta Description: Learn how to install GitHub CLI (gh) on macOS,…

Read More

What is a GitHub App?

๐Ÿง  What is a GitHub App? A GitHub App is a first-class actor in the GitHub ecosystem. Unlike OAuth apps which act on behalf of a user,…

Read More

How to Integrate GitHub with Eclipse (EGit): Setup, Authentication, and Daily Workflow

Learn a clean, modern way to connect GitHub and Eclipse using EGit, choose between HTTPS+PAT or SSH authentication, and run an efficient commit/push workflow. This guide replaces the original teaser post with practical, step-by-step instructions.

Read More
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
0
Would love your thoughts, please comment.x
()
x