-
Notifications
You must be signed in to change notification settings - Fork 3
104 lines (102 loc) · 3.86 KB
/
gradle-deploy.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
96
97
98
99
100
101
102
103
104
name: Build and Deploy
on:
push:
branches: [ main ]
jobs:
backend:
environment: Demo
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 21
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build and Deploy to Docker Registry
run: ./gradlew build jib -Pdocker_registry=${{ secrets.DOCKER_REGISTRY }} -Pdocker_registry_username=${{ secrets.DOCKER_USERNAME }} -Pdocker_registry_password=${{ secrets.DOCKER_PASSWORD }}
env:
CI_PASSWORD: ${{ secrets.CI_PASSWORD }}
- name: Upload Functions Artifacts
uses: actions/upload-artifact@v3
with:
name: functions
path: './functions/build/azure-functions/vtch-functions/'
retention-days: 1
frontend:
environment: Demo
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build and Deploy Frontend
run: >
docker login ${{ secrets.DOCKER_REGISTRY }} -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} &&
docker build -t ${{ secrets.DOCKER_REGISTRY }}/microservice-kubernetes-cluster/frontend:${GITHUB_SHA} -t ${{ secrets.DOCKER_REGISTRY }}/microservice-kubernetes-cluster/frontend:latest ./frontend &&
docker push ${{ secrets.DOCKER_REGISTRY }}/microservice-kubernetes-cluster/frontend:latest &&
docker push ${{ secrets.DOCKER_REGISTRY }}/microservice-kubernetes-cluster/frontend:${GITHUB_SHA}
functions:
needs: backend
environment: Demo
runs-on: ubuntu-latest
steps:
- name: Download Functions Artifacts
uses: actions/download-artifact@v3
with:
name: functions
path: vtch-functions
- name: Deploy Azure Functions
uses: Azure/functions-action@v1
id: fa
with:
app-name: vtch-functions
package: './vtch-functions'
publish-profile: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }}
argocd:
needs: [backend, frontend]
environment: Demo
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Python install requests dependency
uses: py-actions/py-dependency-install@v4
with:
path: "scripts/release-toggles/requirements.txt"
update-pip: "false"
update-setuptools: "false"
update-wheel: "false"
- name: Deploy to ArgoCD
env:
ARGOCD_SERVER: argocd.aks-demo.vtch.tech:80
ARGOCD_AUTH_TOKEN: ${{ secrets.ARGOCD_TOKEN }}
run: >
releaseToggles=$(python scripts/release-toggles/findJiraTickets.py ${{ secrets.JIRA_TOKEN }}) &&
echo "Release Toggles are $releaseToggles" &&
curl -sSL -o argocd http://argocd.aks-demo.vtch.tech:80/download/argocd-linux-amd64 &&
chmod +x argocd &&
./argocd app set applications -p image.tag=${GITHUB_SHA} -p releaseToggles=$releaseToggles --plaintext --grpc-web &&
./argocd app sync applications --plaintext --grpc-web &&
./argocd app sync -l app.kubernetes.io/instance=applications --plaintext --grpc-web
docs:
needs: argocd
environment: Demo
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 21
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Publish API Documentation
run: ./gradlew gitPublishPush --no-parallel -Prerun -x jacocoTestReport
env:
CI_PASSWORD: ${{ secrets.CI_PASSWORD }}
GRGIT_USER: ${{ secrets.GIT_USER }}