File tree Expand file tree Collapse file tree 1 file changed +32
-5
lines changed Expand file tree Collapse file tree 1 file changed +32
-5
lines changed Original file line number Diff line number Diff line change 6
6
# separate terms of service, privacy policy, and support
7
7
# documentation.
8
8
9
+ # Action name
9
10
name : Java CI with Maven
10
11
12
+ # When will the action run
11
13
on :
12
14
push :
13
15
branches : [ "testGitHub-Action" ]
14
16
pull_request :
15
17
branches : [ "testGitHub-Action" ]
16
18
17
19
jobs :
20
+ # build the project
18
21
build :
19
22
20
23
runs-on : ubuntu-latest
@@ -30,10 +33,34 @@ jobs:
30
33
java-version : ' 17'
31
34
distribution : ' temurin'
32
35
cache : maven
36
+
33
37
- name : Build with Maven
34
38
run : mvn clean package --file pom.xml
35
- - name : Upload artifact
36
- uses : actions/upload-artifact@v4
37
- with :
38
- name : bu-secondhand-1.0.0
39
- path : ./code/backend/target/bu-secondhand-1.0.0.jar
39
+
40
+ # - name: Upload artifact
41
+ # uses: actions/upload-artifact@v4
42
+ # with:
43
+ # name: bu-secondhand-1.0.0
44
+ # path: ./code/backend/target/bu-secondhand-1.0.0.jar
45
+
46
+ # build a docker image and push it to Docker Hub
47
+ deploy :
48
+ runs-on : ubuntu-latest
49
+ defaults :
50
+ run :
51
+ working-directory : ./code/backend
52
+ steps :
53
+ - name : Login to Docker Hub
54
+ uses : docker/login-action@v3
55
+ with :
56
+ username : ${{ vars.DOCKERHUB_USERNAME }}
57
+ password : ${{ secrets.DOCKERHUB_TOKEN }}
58
+
59
+ - name : Set up Docker Buildx
60
+ uses : docker/setup-buildx-action@v3
61
+
62
+ - name : Build and push
63
+ uses : docker/build-push-action@v6
64
+ with :
65
+ push : true
66
+ tags : ${{ vars.DOCKERHUB_USERNAME }}/campus_exchange:latest
You can’t perform that action at this time.
0 commit comments