-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (40 loc) · 1.16 KB
/
ci-cd.yml
File metadata and controls
48 lines (40 loc) · 1.16 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
name: CI/CD Pipeline
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install dependencies
run: |
npm install --prefix user-service
npm install --prefix product-service
npm install --prefix order-service
npm install --prefix api-gateway
- name: Run tests
run: |
npm test --prefix user-service
npm test --prefix product-service
- name: Build Docker images
run: |
docker build -t user-service:${{ github.sha }} ./user-service
docker build -t product-service:${{ github.sha }} ./product-service
deploy:
needs: test
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Deploy to Azure Container Instances
run: |
az container create \
--resource-group microservices-rg \
--name user-service-${{ github.sha }} \
--image user-service:${{ github.sha }}