-
Notifications
You must be signed in to change notification settings - Fork 5
87 lines (65 loc) · 2.49 KB
/
ci.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
name: CI
on:
push:
branches: [ main ]
#pull_request:
#branches: [ main ]
jobs:
test:
name: Testing
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Testing Env.
run: make build_test
- name: Give Access
run: sudo chmod 666 /var/run/docker.sock
- name: Run Tests
run: make run_test
deploy:
runs-on: ubuntu-18.04
needs: test
steps:
- name: Checkout Latest Repo
uses: actions/checkout@master
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build Backend Docker Image
run: docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/swbackend -f ./Back-End/Dockerfile ./Back-End
- name: Tag Backend Image
run: docker tag ${{ secrets.DOCKERHUB_USERNAME }}/swbackend ${{ secrets.DOCKERHUB_USERNAME }}/swbackend:latest
- name: Push Backend to DockerHub
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/swbackend
- name: Build FrontEnd Docker Image
run: docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/swfront -f ./Front-End/Dockerfile ./Front-End
- name: Tag FrontEnd Image
run: docker tag ${{ secrets.DOCKERHUB_USERNAME }}/swfront ${{ secrets.DOCKERHUB_USERNAME }}/swfront:latest
- name: Push FrontEnd to DockerHub
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/swfront
- name: Get Timestamp
uses: gerred/actions/current-time@master
id: current-time
- name: Run String Replace
uses: frabert/replace-string-action@master
id: format-time
with:
pattern: '[:\.]+'
string: "${{ steps.current-time.outputs.time }}"
replace-with: '-'
flags: 'g'
- name: Generate Deployment Package
run: zip -r deploy.zip * -x "**node_modules**"
- name: Deploy to EB
uses: einaregilsson/beanstalk-deploy@v16
with:
aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
application_name: HABIBSW
environment_name: Habibsw-env-1
version_label: "docker-app-${{ steps.format-time.outputs.replaced }}"
region: us-east-1
deployment_package: deploy.zip