Skip to content

Commit a5d3aa9

Browse files
committed
Build and push docker images and helm charts on every push to develop
We will used these published images and charts to deploy go-api once we move deployment to a separate repo refs #1885
1 parent 1deaa5f commit a5d3aa9

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Builds and pushes Docker Images and Helm charts to Github Registry
2+
3+
on:
4+
# Build and push Docker image and Helm charts on every push to develop branch
5+
# and on every tag push
6+
push:
7+
branches:
8+
- develop
9+
tags:
10+
- "**"
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Docker Buildx
21+
uses: docker/setup-buildx-action@v3
22+
23+
- name: Login to GitHub Container Registry
24+
uses: docker/login-action@v3
25+
with:
26+
registry: ghcr.io
27+
username: ${{ github.actor }}
28+
password: ${{ secrets.GITHUB_TOKEN }}
29+
30+
- name: Install chart publishing dependencies (chartpress, helm)
31+
run: |
32+
pip install chartpress
33+
pip list
34+
35+
helm version
36+
37+
- name: Build and push Docker image. Update the image tag, chart version etc as needed
38+
run: |
39+
cd deploy/helm
40+
# hack to push the image to ghcr.io. We will update chartpress.yaml when we move to separate deploy repo
41+
python -c "import re; data=open('chartpress.yaml').read(); open('chartpress.yaml', 'w').write(re.sub(r'ifrcgoacr.azurecr.io/ifrcgo-', 'ghcr.io/IFRCGo/go-', data))"
42+
chartpress --push
43+
44+
- name: Get the version
45+
id: get_version
46+
run: echo ::set-output name=VERSION::$(cat deploy/helm/ifrcgo-helm/Chart.yaml | grep version | awk '{print $2}')
47+
48+
- name: Package Helm Chart
49+
run: |
50+
helm package deploy/helm/ifrcgo-helm -d .helm-charts
51+
52+
- name: Push Helm Chart
53+
run: |
54+
helm push .helm-charts/ifrcgo-helm-${{ steps.get_version.outputs.VERSION }}.tgz oci://ghcr.io/IFRCGo/go-api

0 commit comments

Comments
 (0)