generated from CS3219-AY2324S1/course-assessment-template
-
Notifications
You must be signed in to change notification settings - Fork 3
101 lines (83 loc) · 3.05 KB
/
deploy.yaml
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
name: Pre-release build test
on:
pull_request:
branches:
- master
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2 # Use v2 of the action
- name: Login to Docker Hub
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
- name: Create env file for userservice test
run: echo -e "${{ secrets.USER_SERVICE_TEST_ENV_FILE}}" > ./user-service/.env
- name: Build PostgreSQL Docker image
working-directory: ./user-service
run: |
docker build -f Dockerfile.postgres-db -t user-service-psql .
- name: Start PostgreSQL Docker container
working-directory: ./user-service
run: |
docker run -p 1111:5432 -e POSTGRES_PASSWORD=123 --name user-service-db -d user-service-psql
sleep 10
- name: Build and test user-service
working-directory: ./user-service
run: |
npm ci
npm run test
- name: Stop and remove PostgreSQL Docker container
run: |
docker stop user-service-db
docker rm user-service-db
- name: Build and test client
working-directory: ./client
run: |
npm ci
npm test
- name: Build and test question-service
working-directory: ./question-service
run: |
npm ci
npm test
- name: Build and test matching-service
working-directory: ./matching-service
run: |
npm ci
npm run test
- name: Build and test collaboration-service
working-directory: ./collaboration-service
run: |
npm ci
npm run test
- name: Prevent PR merge
if: github.event.pull_request.merged == 'true'
run: echo "This PR cannot be merged. Please make necessary changes."
- name: Set up pre-release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GH_TOKEN }}"
automatic_release_tag: "pre-release"
prerelease: true
title: "Pre-release build"
# - name: Build Docker containers
# run: docker-compose -f docker-compose.yml build
# - name: Push Docker containers to Docker Hub
# run: docker-compose -f docker-compose.yml push
# - name: Generate deployment package
# run: zip -r deploy.zip . -x '*.git*'
# - name: Deploy to AWS Elastic Beanstalk
# uses: einaregilsson/beanstalk-deploy@v18
# with:
# aws_access_key: ${{ secrets.AWS_ACCESS_KEY }}
# aws_secret_key: ${{ secrets.AWS_SECRET_KEY }}
# application_name: multi-docker
# environment_name: Multi-docker-env
# existing_bucket_name: elasticbeanstalk-ap-southeast-1-332848504892
# region: ap-southeast-1
# version_label: ${{ github.sha }}
# deployment_package: deploy.zip