-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (44 loc) · 1.55 KB
/
build.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
name: Build and Push Docker Image
on:
push:
branches: [ 'main' ]
paths: ['source-code/**']
pull_request:
branches: [ 'main' ]
paths: ['source-code/**']
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: docker login
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD
- name: Build the Docker image
working-directory: ./source-code
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKER_USERNAME }}
run: docker build . -f Dockerfile -t $DOCKERHUB_USERNAME/node-argo-k8s:${GITHUB_SHA::7}
- name: Push the Docker image
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKER_USERNAME }}
run: docker push $DOCKERHUB_USERNAME/node-argo-k8s:${GITHUB_SHA::7}
- name: Update the Docker image tag in the values.yaml
uses: fjogeleit/[email protected]
with:
valueFile: ./node-argo-k8s-helm/values.yaml
propertyPath: 'image.tag'
value: ${GITHUB_SHA::7}
branch: main/${GITHUB_SHA::7}
targetBranch: main
createPR: true
message: 'Updated the image tag to ${GITHUB_SHA::7}'
commitUserName: github-actions[bot]
commitUserEmail: 41898282+github-actions[bot]@users.noreply.github.com
masterBranchName: main