Deploy API to Openshift 4 Registry #61
This file contains 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: Deploy API to Openshift 4 Registry | |
on: | |
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 }} |