Skip to content

[Parvathy, Rahul] | BAH-3197 | Fix. MySQL Connection Error #131

[Parvathy, Rahul] | BAH-3197 | Fix. MySQL Connection Error

[Parvathy, Rahul] | BAH-3197 | Fix. MySQL Connection Error #131

Workflow file for this run

name: Build and Publish
on:
push:
branches:
- master
- 'release-*'
tags:
- '[0-9]+.[0-9]+.[0-9]+'
env:
HELM_CHART_PATH: package/helm/
jobs:
build-publish-docker-helm:
name: Build & Publish Docker Image & Helm Chart
runs-on: ubuntu-latest
services:
mysql:
image: mysql:5.6
env:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
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:
distribution: 'corretto'
java-version: '11'
- name: Test and Package
run:
./mvnw -T 4 --no-transfer-progress -DskipTests clean package -U
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Docker Build and push
uses: docker/build-push-action@v3
with:
context: .
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
- 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/
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