1+ name : CI/CD Pipeline
2+
3+ on :
4+ push :
5+ branches : [ main, master ]
6+ pull_request :
7+ branches : [ main, master ]
8+
9+ env :
10+ DOCKER_REGISTRY : ccr.ccs.tencentyun.com
11+ DOCKER_NAMESPACE : your-namespace
12+ MAVEN_OPTS : " -Dmaven.repo.local=.m2/repository"
13+ MAVEN_CLI_OPTS : " --batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true"
14+
15+ jobs :
16+ build :
17+ runs-on : ubuntu-latest
18+ steps :
19+ - uses : actions/checkout@v3
20+
21+ - name : Set up JDK 17
22+ uses : actions/setup-java@v3
23+ with :
24+ java-version : ' 17'
25+ distribution : ' temurin'
26+ cache : ' maven'
27+
28+ - name : Build with Maven
29+ run : mvn clean package -DskipTests -Pprod
30+
31+ - name : Upload Artifacts
32+ uses : actions/upload-artifact@v3
33+ with :
34+ name : jar-files
35+ path : " **/target/*.jar"
36+ retention-days : 7
37+
38+ docker-build :
39+ needs : build
40+ runs-on : ubuntu-latest
41+ steps :
42+ - uses : actions/checkout@v3
43+
44+ - name : Download Artifacts
45+ uses : actions/download-artifact@v3
46+ with :
47+ name : jar-files
48+ path : .
49+
50+ - name : Set up Docker Buildx
51+ uses : docker/setup-buildx-action@v2
52+
53+ - name : Login to Tencent Cloud Container Registry
54+ uses : docker/login-action@v2
55+ with :
56+ registry : ${{ env.DOCKER_REGISTRY }}
57+ username : ${{ secrets.DOCKER_REGISTRY_USERNAME }}
58+ password : ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
59+
60+ - name : Build and push im-gateway
61+ uses : docker/build-push-action@v4
62+ with :
63+ context : ./im-gateway
64+ push : true
65+ tags : ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_NAMESPACE }}/im-gateway:${{ github.sha }}
66+
67+ - name : Build and push ruoyi-auth
68+ uses : docker/build-push-action@v4
69+ with :
70+ context : ./framework/ruoyi-auth
71+ push : true
72+ tags : ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_NAMESPACE }}/ruoyi-auth:${{ github.sha }}
73+
74+ - name : Build and push ruoyi-system
75+ uses : docker/build-push-action@v4
76+ with :
77+ context : ./framework/ruoyi-modules/ruoyi-system
78+ push : true
79+ tags : ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_NAMESPACE }}/ruoyi-system:${{ github.sha }}
80+
81+ - name : Build and push ruoyi-gen
82+ uses : docker/build-push-action@v4
83+ with :
84+ context : ./framework/ruoyi-modules/ruoyi-gen
85+ push : true
86+ tags : ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_NAMESPACE }}/ruoyi-gen:${{ github.sha }}
87+
88+ - name : Build and push ruoyi-job
89+ uses : docker/build-push-action@v4
90+ with :
91+ context : ./framework/ruoyi-modules/ruoyi-job
92+ push : true
93+ tags : ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_NAMESPACE }}/ruoyi-job:${{ github.sha }}
94+
95+ - name : Build and push ruoyi-resource
96+ uses : docker/build-push-action@v4
97+ with :
98+ context : ./framework/ruoyi-modules/ruoyi-resource
99+ push : true
100+ tags : ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_NAMESPACE }}/ruoyi-resource:${{ github.sha }}
101+
102+ - name : Build and push im-core-server
103+ uses : docker/build-push-action@v4
104+ with :
105+ context : ./im-core/im-core-server
106+ push : true
107+ tags : ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_NAMESPACE }}/im-core-server:${{ github.sha }}
108+
109+
110+ deploy :
111+ needs : docker-build
112+ runs-on : ubuntu-latest
113+ if : github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
114+ steps :
115+ - name : Deploy to production
116+ run : echo "Deployment steps would go here"
117+ - name : Manual approval
118+ uses : trstringer/manual-approval@v1
119+ with :
120+ secret : ${{ github.token }}
121+ approvers : your-github-username
122+ minimum-approvals : 1
123+ exclude-authors : github-actions[bot]
0 commit comments