Skip to content

Commit

Permalink
GHA Chnages
Browse files Browse the repository at this point in the history
  • Loading branch information
sivareddyp committed Sep 21, 2023
1 parent b413e3a commit 6116243
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 48 deletions.
73 changes: 26 additions & 47 deletions .github/workflows/build_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@ name: Build and Publish
on:
push:
branches:
- master
- 'release-*'
- snomed-master
- 'snomed-release-*'
- snomed-temp
tags:
- '[0-9]+.[0-9]+.[0-9]+'

env:
HELM_CHART_PATH: package/helm/
- 'snomed-[0-9]+.[0-9]+.[0-9]+'

jobs:
build-publish-docker-helm:
name: Build & Publish Docker Image & Helm Chart
build-publish-docker:
name: Build & Publish Docker Image
runs-on: ubuntu-latest
services:
mysql:
Expand All @@ -24,11 +22,6 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set env.ARTIFACT_VERSION
run: |
wget -q https://raw.githubusercontent.com/Bahmni/bahmni-infra-utils/main/setArtifactVersion.sh && chmod +x setArtifactVersion.sh
./setArtifactVersion.sh
rm setArtifactVersion.sh
- name: Setup Java 11
uses: actions/setup-java@v3
with:
Expand All @@ -53,39 +46,25 @@ jobs:
platforms: linux/amd64,linux/arm64
file: package/docker/bahmni-reports/Dockerfile
push: true
tags: bahmni/reports:${{env.ARTIFACT_VERSION}},bahmni/reports:latest

- name: Helm - Update Version and Image Tag
run: |
yq --inplace '.image.tag = "${{ env.ARTIFACT_VERSION }}"' $HELM_CHART_PATH/values.yaml
yq --inplace '.version = "${{ env.ARTIFACT_VERSION }}"' $HELM_CHART_PATH/Chart.yaml
tags: bahmni/reports:snomed-${{ github.run_number }},bahmni/reports:snomed-latest

- name: Helm Lint
run: helm lint $HELM_CHART_PATH

- name: Helm Package
run: helm package $HELM_CHART_PATH

- name: Helm - Checkout Charts Repository
uses: actions/checkout@v2
with:
repository: Bahmni/helm-charts
ref: gh-pages
path: helm-charts
persist-credentials: false

- name: Helm - Copy chart
run: mkdir -p helm-charts/reports/ && cp reports-${{ env.ARTIFACT_VERSION }}.tgz helm-charts/reports/

- name: Helm - reIndex
working-directory: helm-charts/
run: helm repo index --merge index.yaml --url https://bahmni.github.io/helm-charts/ .

- name: Helm - Publish Chart
working-directory: helm-charts/
trigger:
name: Trigger Deployment Workflow to SNOMED Environment
needs:
- build-publish-docker
runs-on: ubuntu-latest
env:
ORG_NAME: Bahmni
REPOSITORY_NAME: snomed-bahmni-docker
ENVIRONMENT: dev
steps:
- name: Create workflow_dispatch
run: |
git config user.name ${{ secrets.BAHMNI_USERNAME}}
git config user.email ${{ secrets.BAHMNI_EMAIL}}
git add .
git commit -m "Release of reports-${{ env.ARTIFACT_VERSION }}"
git push 'https://${{ secrets.BAHMNI_USERNAME}}:${{ secrets.BAHMNI_PAT}}@github.com/bahmni/helm-charts.git' gh-pages
trigger_result=$(curl -s -o trigger_response.txt -w "%{http_code}" -X POST -H "Accept: application/vnd.github.v3+json" -H 'authorization: Bearer ${{ secrets.BAHMNI_PAT }}' https://api.github.com/repos/${ORG_NAME}/${REPOSITORY_NAME}/actions/workflows/snomed-deploy.yml/dispatches -d '{"ref":"snomed-master","inputs":{"environment":"'"${ENVIRONMENT}"'"}}')
if [ $trigger_result == 204 ];then
echo "Trigger to $ORG_NAME/$REPOSITORY_NAME Success"
else
echo "Trigger to $ORG_NAME/$REPOSITORY_NAME Failed"
cat trigger_response.txt
exit 1
fi
2 changes: 1 addition & 1 deletion .github/workflows/validate_pr.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Validate PR
on:
pull_request:
branches: [ master ]
branches: [ snomed-temp ]
jobs:
build-package:
name: Build Package
Expand Down

0 comments on commit 6116243

Please sign in to comment.