File tree 1 file changed +59
-0
lines changed
1 file changed +59
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : CI Pipeline
2
+
3
+ on :
4
+ push :
5
+ branches : [ "main" ]
6
+ workflow_dispatch :
7
+
8
+ jobs :
9
+
10
+ app_build :
11
+ runs-on : ubuntu-latest
12
+ steps :
13
+ - name : checkout code
14
+ uses : actions/checkout@v3
15
+
16
+ - name : setup java
17
+ uses : actions/setup-java@v3
18
+ with :
19
+ distribution : ' temurin'
20
+ java-version : ' 17'
21
+
22
+ - name : cache maven dependencies
23
+ uses : actions/cache@v3
24
+ with :
25
+ path : ~/.m2/repository
26
+ key : ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
27
+ restore-keys : |
28
+ ${{ runner.os }}-maven
29
+
30
+ - name : build project
31
+ run : mvn -B clean install
32
+
33
+ docker_login_build_push :
34
+ needs : app_build
35
+ runs-on : ubuntu-latest
36
+ steps :
37
+ - name : login DockerHub
38
+ uses : docker/login-action@v3
39
+ with :
40
+ username : ${{ secrets.DOCKER_USERNAME }}
41
+ password : ${{ secrets.DOCKER_PASSWORD }}
42
+
43
+ - name : build and push docker image
44
+ uses : docker/build-push-action@v4
45
+ with :
46
+ push : true
47
+ tags : ${{ secrets.DOCKER_USERNAME }}/catalog:latest
48
+ file : ./Dockerfile
49
+ context : .
50
+
51
+ app_upload_artifact :
52
+ needs : app_build
53
+ runs-on : ubuntu-latest
54
+ steps :
55
+ - name : upload maven artifact
56
+ uses : actions/upload-artifact@v3
57
+ with :
58
+ name : packaged-application
59
+ path : target/*.jar
You can’t perform that action at this time.
0 commit comments