-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (69 loc) · 2.34 KB
/
Copy pathAdminServiceWorkflow.yml
File metadata and controls
88 lines (69 loc) · 2.34 KB
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
name: Build and Deploy AdminService
on:
push:
paths:
- 'AdminService/src/AdminService/**'
env:
IMAGE_REPOSITORY: jobbie_adminserviceapi
CONTAINER_REGISTRY: jobbieregistry.azurecr.io
DOCKERFILE_PATH: AdminService/src/AdminService/Dockerfile
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build Docker Image
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.set-tag.outputs.tag }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set image tag
id: set-tag
run: echo "tag=${{ github.run_number }}" >> $GITHUB_OUTPUT
- name: Build Docker image
run: |
docker build -t ${{ env.CONTAINER_REGISTRY }}/${{ env.IMAGE_REPOSITORY }}:${{ github.run_number }} \
-f ${{ env.DOCKERFILE_PATH }} .
- name: Save Docker image to tarball
run: |
docker save ${{ env.CONTAINER_REGISTRY }}/${{ env.IMAGE_REPOSITORY }}:${{ github.run_number }} -o image.tar
- name: Upload built image
uses: actions/upload-artifact@v4
with:
name: built-image
path: image.tar
push:
name: Push to ACR
runs-on: ubuntu-latest
needs: build
steps:
- name: Download built image
uses: actions/download-artifact@v4
with:
name: built-image
- name: Load Docker image
run: docker load -i image.tar
- name: Log in to Azure Container Registry
uses: azure/docker-login@v1
with:
login-server: ${{ env.CONTAINER_REGISTRY }}
username: ${{ secrets.AZURE_ACR_USERNAME }}
password: ${{ secrets.AZURE_ACR_PASSWORD }}
- name: Push Docker image
run: |
docker push ${{ env.CONTAINER_REGISTRY }}/${{ env.IMAGE_REPOSITORY }}:${{ needs.build.outputs.tag }}
update-manifest:
name: Update Kubernetes Manifest
runs-on: ubuntu-latest
needs: [push, build]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Update Kubernetes Manifest
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
run: |
chmod +x scripts/updateK8sManifests.sh
./scripts/updateK8sManifests.sh AdminService admin-api jobbieregistry.azurecr.io/jobbie_adminserviceapi ${{ needs.build.outputs.tag }}