File tree 2 files changed +54
-2
lines changed
2 files changed +54
-2
lines changed Original file line number Diff line number Diff line change
1
+ name : Eatery Prod Server - CI/CD
2
+
3
+ on :
4
+ push :
5
+ branches : [ "main" ]
6
+
7
+ jobs :
8
+ build :
9
+ runs-on : ubuntu-latest
10
+
11
+ steps :
12
+ - uses : actions/checkout@v3
13
+
14
+ - name : Setup JDK 17
15
+ uses : actions/setup-java@v3
16
+ with :
17
+ java-version : ' 17'
18
+ distribution : ' temurin'
19
+
20
+ - name : Setup environment variables
21
+ run : echo "${{ secrets.ENV_PROPERTIES }}" > ./src/main/resources/env.properties
22
+
23
+ - name : Build with Gradle
24
+ uses : gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
25
+ with :
26
+ arguments : build
27
+
28
+ - name : Docker build and push
29
+ if : ${{ !failure() }}
30
+ run : |
31
+ docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
32
+ docker build -t ${{ secrets.DOCKER_REPO }} --platform linux/arm64 -f Dockerfile .
33
+ docker push ${{ secrets.DOCKER_REPO }}
34
+
35
+ - name : Executing remote ssh commands with docker compose for Continuous Delivery
36
+ if : ${{ !failure() }}
37
+ uses : appleboy/ssh-action@master
38
+ with :
39
+ host : ${{ secrets.AWS_EC2_HOST }}
40
+ username : ec2-user
41
+ key : ${{ secrets.AWS_EC2_KEY }}
42
+ port : 22
43
+ script : |
44
+ cd /home/ec2-user/hertz
45
+ docker-compose down
46
+ docker pull ${{ secrets.DOCKER_REPO }}
47
+ docker-compose up -d
48
+
49
+ - name : Upload Jacoco Report
50
+ if : ${{ !cancelled() }}
51
+ uses : actions/upload-artifact@v3
52
+ with :
53
+ name : jacoco-report
54
+ path : build/reports/jacoco/test/html
Original file line number Diff line number Diff line change 1
1
name : Hertz Server - CI
2
2
3
3
on :
4
- push :
5
- branches : [ "main" ]
6
4
pull_request :
7
5
branches : [ "main" ]
8
6
You can’t perform that action at this time.
0 commit comments