-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (45 loc) · 1.7 KB
/
deployment.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
name: Build and Deploy
on:
workflow_dispatch:
push:
branches: [ "master" ]
jobs:
publish:
runs-on: ubuntu-latest
outputs:
image: ${{ steps.image_name.outputs.image }}
steps:
- uses: actions/checkout@v3
- name: Generate image name
id: image_name
run: echo "image=$(date +%s)" >> $GITHUB_OUTPUT
- name: Login to Harbor
run: |
echo $HARBOR_PASSWORD | docker login $HARBOR_URI -u $HARBOR_USERNAME --password-stdin
env:
HARBOR_USERNAME: ${{ secrets.HARBOR_USERNAME }}
HARBOR_PASSWORD: ${{ secrets.HARBOR_PASSWORD }}
HARBOR_URI: ${{ secrets.HARBOR_URI }}
- name: Build the Docker image
run: docker buildx build . --file Dockerfile --tag $HARBOR_URI/abstractolotl/aznopoly-web:${IMAGE_NAME} --tag $HARBOR_URI/abstractolotl/aznopoly-web:latest
env:
HARBOR_URI: ${{ secrets.HARBOR_URI }}
IMAGE_NAME: ${{ steps.image_name.outputs.image }}
- name: Push the Docker image
run: docker push $HARBOR_URI/abstractolotl/aznopoly-web --all-tags
env:
HARBOR_URI: ${{ secrets.HARBOR_URI }}
deployment:
needs: publish
runs-on: ubuntu-latest
steps:
- name: 'Checkout' # Checkout the repository code.
uses: 'actions/checkout@v3'
- name: Deploy
uses: WyriHaximus/github-action-helm3@v3
with:
exec: helm upgrade --install --atomic --timeout 5m --history-max 5 --namespace=frontend --set image.tag=${IMAGE_NAME} aznopoly-web helm-charts
kubeconfig: '${{ secrets.KUBECONFIG }}'
env:
HARBOR_URI: ${{ secrets.HARBOR_URI }}
IMAGE_NAME: ${{needs.publish.outputs.image}}