Skip to content

Build and Publish

Build and Publish #508

Workflow file for this run

name: Build and Publish
on:
push:
branches:
- master
- 'release-*'
tags:
- '[0-9]+.[0-9]+.[0-9]+'
workflow_dispatch:
jobs:
build-publish-docker-helm:
name: Build & Publish Docker Image & Helm Chart
runs-on: ubuntu-latest
env:
HELM_CHART_PATH: package/helm/
steps:
- 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: Use Node.js 10.16.3
uses: actions/setup-node@v1
with:
node-version: 10.16.3
- name: Use Ruby 2.5
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.5
- run: npm install -g bower
- run: npm install -g grunt-cli
- run: gem install compass
- run: npm install --global yarn
- name: Package
run: cd ui && yarn cache clean && /bin/bash ./scripts/package.sh
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Push Translations to Transifex
run: |
bash .github/scripts/transifex.sh
env:
TX_TOKEN: ${{ secrets.TX_TOKEN }}
- 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/Dockerfile
push: true
tags: bahmni/bahmni-web:${{ env.ARTIFACT_VERSION }},bahmni/bahmni-web:latest
- name: 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: Checkout Charts Repository
uses: actions/checkout@v2
with:
repository: Bahmni/helm-charts
ref: gh-pages
path: helm-charts
persist-credentials: false
- name: Copy Helm Archive
run: cp bahmni-web-${{ env.ARTIFACT_VERSION }}.tgz helm-charts/bahmni-web/
- name: Helm Index
working-directory: helm-charts/
run: helm repo index --merge index.yaml --url https://bahmni.github.io/helm-charts/ .
- name: Commit and Push Chart Repository
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 bahmni-web-${{ env.ARTIFACT_VERSION }}"
git push 'https://${{ secrets.BAHMNI_USERNAME}}:${{ secrets.BAHMNI_PAT}}@github.com/bahmni/helm-charts.git' gh-pages