Skip to content

Merge pull request #368 from bcgov/cron-job #69

Merge pull request #368 from bcgov/cron-job

Merge pull request #368 from bcgov/cron-job #69

name: Deploy API to Openshift 4 Registry
on:
schedule:
- cron: "0 0 * */3 *"
push:
branches: [main]
paths:
- "src/backend/**"
- ".github/workflows/deploy-api-oc4.yml"
workflow_dispatch: {}
jobs:
git_sha:
uses: SierraSystems/reusable-workflows/.github/workflows/get-github-commitversion.yml@main
with:
working_directory: "."
build:
needs:
- git_sha
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Login to the Openshift Cluster
run: |
oc login --token=${{ secrets.OPENSHIFT4_SA_PASSWORD }} --server=${{ secrets.OPENSHIFT4_EXTERNAL_REPOSITORY }}
- name: Login to Openshift Docker
run : |
docker login ${{ secrets.OPENSHIFT4_EXTERNAL_REPOSITORY }} -u ${{ secrets.OPENSHIFT4_SA_USERNAME }} -p ${{ secrets.OPENSHIFT4_SA_PASSWORD }}
- name: Build the Docker image
env:
MVN_PROFILE: ai-reviewer,splunk
COMPOSE_DOCKER_CLI_BUILD: 1
DOCKER_BUILDKIT: 1
run: |
docker-compose build ai-reviewer-api
docker tag jag-ai-reviewer_ai-reviewer-api ${{ secrets.OPENSHIFT4_EXTERNAL_REPOSITORY }}/${{ secrets.OPENSHIFT4_TOOLS_NAMESPACE }}/ai-reviewer-api:latest
docker push ${{ secrets.OPENSHIFT4_EXTERNAL_REPOSITORY }}/${{ secrets.OPENSHIFT4_TOOLS_NAMESPACE }}/ai-reviewer-api:latest
docker tag jag-ai-reviewer_ai-reviewer-api ${{ secrets.OPENSHIFT4_EXTERNAL_REPOSITORY }}/${{ secrets.OPENSHIFT4_TOOLS_NAMESPACE }}/ai-reviewer-api:${{ needs.git_sha.outputs.github-release-version }}
docker push ${{ secrets.OPENSHIFT4_EXTERNAL_REPOSITORY }}/${{ secrets.OPENSHIFT4_TOOLS_NAMESPACE }}/ai-reviewer-api:${{ needs.git_sha.outputs.github-release-version }}