-
Notifications
You must be signed in to change notification settings - Fork 25
95 lines (88 loc) · 3.5 KB
/
build_upload.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: Build and Upload
on:
push:
branches:
- main
- 'release-*'
tags:
- '[0-9]+.[0-9]+.[0-9]+'
paths-ignore:
- "**.md"
workflow_run:
workflows: [Pull Translations from Transifex]
types: [completed]
branches:
- main
- 'release-*'
workflow_dispatch:
jobs:
build-publish-docker-helm:
name: Build & Publish Docker Image & Helm Chart
runs-on: ubuntu-latest
env:
HELM_CHART_PATH: package/helm/clinic-config
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: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Docker - Login
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: .
file: package/docker/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: bahmni/clinic-config:${{env.ARTIFACT_VERSION}},bahmni/clinic-config:latest
- name: Push Translations to Transifex
run: |
bash .github/scripts/transifex.sh push
env:
TX_TOKEN: ${{ secrets.TX_TOKEN }}
- name: Pull Bahmni Default Config Helm Chart
run: |
helm pull default-config --repo https://bahmni.github.io/helm-charts --devel --untar --untardir package/helm
mv package/helm/default-config/ package/helm/clinic-config/
- name: Update Chart values
run: |
yq --inplace '.image.repository = "bahmni"' $HELM_CHART_PATH/values.yaml
yq --inplace '.image.name = "clinic-config"' $HELM_CHART_PATH/values.yaml
yq --inplace '.image.tag = "${{ env.ARTIFACT_VERSION }}"' $HELM_CHART_PATH/values.yaml
yq --inplace '.version = "${{ env.ARTIFACT_VERSION }}"' $HELM_CHART_PATH/Chart.yaml
yq --inplace '.name = "clinic-config"' $HELM_CHART_PATH/Chart.yaml
yq --inplace '.description = "Helm chart for clinic-config of bahmni"' $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/clinic-config/ && cp clinic-config-${{ env.ARTIFACT_VERSION }}.tgz helm-charts/clinic-config/
- 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 clinic-config-${{ env.ARTIFACT_VERSION }}"
git push 'https://${{ secrets.BAHMNI_USERNAME}}:${{ secrets.BAHMNI_PAT}}@github.com/bahmni/helm-charts.git' gh-pages