generated from CS3219-AY2324S1/course-assessment-template
-
Notifications
You must be signed in to change notification settings - Fork 4
103 lines (87 loc) · 3.12 KB
/
build_push_registry.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
name: Selectively Build and Push to Artifact Registry
on:
push:
branches: ["master"]
env:
PROJECT_ID: cs3219-400714
REGION: asia-southeast1
GAR_LOCATION: asia-southeast1-docker.pkg.dev/cs3219-400714/peerprep/
jobs:
build-push-artifact:
runs-on: ubuntu-latest
outputs:
build_status: ${{ steps.set_output.outputs.build_status }}
steps:
- name: "Checkout"
uses: "actions/checkout@v3"
- name: Detect Changes in Microservices
id: changes
uses: dorny/paths-filter@v2
with:
filters: |
frontend:
- 'frontend/**'
user_service:
- 'user_service/**'
question_service:
- 'question_service/**'
matching_service:
- 'user_service/**'
match_worker:
- 'match_worker/**'
collab_service:
- 'collab_service/**'
- name: 'Create env file'
run: |
echo "${{ secrets.ENV_FILE }}" > .env
- name: "Set up google auth"
id: auth
uses: "google-github-actions/auth@v1"
with:
credentials_json: "${{ secrets.SERVICE_ACCOUNT_KEY }}"
- name: "Set up Cloud SDK"
uses: "google-github-actions/setup-gcloud@v1"
- name: "Use gcloud CLI"
run: "gcloud info"
- name: "Docker auth"
run: |-
gcloud auth configure-docker ${{ env.REGION }}-docker.pkg.dev --quiet
- name: Determine Build Status
id: set_output
run: echo "::set-output name=build_status::false"
- name: 1. Build and Push frontend
if: steps.changes.outputs.frontend == 'true'
run: |
docker-compose build frontend
docker-compose push frontend
echo "::set-output name=build_status::true"
- name: 2. Build and Push question-service
if: steps.changes.outputs.question_service == 'true'
run: |
docker-compose build question-service
docker-compose push question-service
echo "::set-output name=build_status::true"
- name: 3. Build and Push user-service
if: steps.changes.outputs.user_service == 'true'
run: |
docker-compose build user-service
docker-compose push user-service
echo "::set-output name=build_status::true"
- name: 4. Build and Push matching-service
if: steps.changes.outputs.matching_service == 'true'
run: |
docker-compose build matching-service
docker-compose push matching-service
echo "::set-output name=build_status::true"
- name: 5. Build and Push match-worker
if: steps.changes.outputs.match_worker == 'true'
run: |
docker-compose build match-worker
docker-compose push match-worker
echo "::set-output name=build_status::true"
- name: 6. Build and Push collab-service
if: steps.changes.outputs.collab_service == 'true'
run: |
docker-compose build collab-service
docker-compose push collab-service
echo "::set-output name=build_status::true"