-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (52 loc) · 2.16 KB
/
ci-pipeline.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
name: Continuous Integration
on:
push:
paths-ignore:
- "diagrams/*"
- "**/README.md"
jobs:
build:
name: Build and test
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Build test Docker image
run: docker build --target test --tag backend:test ./backend
- name: Run tests
run: docker run --env-file backend/.env.test backend:test
publish:
name: Publish To Docker
runs-on: ubuntu-latest
needs: build
if: ${{ (github.ref == 'refs/heads/main') && (github.event_name == 'push') }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
- name: Build frontend Docker image
working-directory: frontend
run: docker build --target production --tag calpin/playlist-manager-frontend:prod .
- name: Push frontend Docker image
working-directory: frontend
run: docker push calpin/playlist-manager-frontend:prod
- name: Build backend Docker image
working-directory: backend
run: docker build --target production --tag calpin/playlist-manager-backend:prod .
- name: Push backend Docker image
working-directory: backend
run: docker push calpin/playlist-manager-backend:prod
deploy:
name: Deploy to Azure
runs-on: ubuntu-latest
needs: publish
if: ${{ (github.ref == 'refs/heads/main') && (github.event_name == 'push') }}
steps:
- name: Trigger Azure frontend deployment webhook
run: curl -dH -X POST '${{ secrets.AZURE_DEPLOYMENT_WEBHOOK_FRONTEND }}'
- name: Trigger Azure backend deployment webhook
run: curl -dH -X POST '${{ secrets.AZURE_DEPLOYMENT_WEBHOOK_BACKEND }}'