1+ name : MarineLeisure Pull Request Script -Test & Image build
2+ on :
3+ pull_request :
4+ branches :
5+ - main
6+ env :
7+ REGISTRY : ghcr.io
8+ IMAGE_NAME : ${{ github.repository }}
9+
10+ jobs :
11+ codetest :
12+ name : 코드 테스트
13+ runs-on : ubuntu-latest
14+
15+ steps :
16+ - name : branch checkout
17+ uses : actions/checkout@v4
18+
19+ - name : JDK setting
20+ uses : actions/setup-java@v4
21+ with :
22+ java-version : ' 21'
23+ distribution : ' temurin'
24+
25+ - name : set Permission
26+ run : chmod +x ./gradlew
27+
28+ - name : do test
29+ run : ./gradlew test --stacktrace --no-daemon -Dspring.profiles.active=test --info
30+ env :
31+ JAVA_TOOL_OPTIONS : " -Dlogging.level.root=DEBUG"
32+
33+ tagging :
34+ name : 태깅 및 릴리즈
35+ runs-on : ubuntu-latest
36+ outputs :
37+ tag_name : ${{ steps.tag_version.outputs.new_tag }}
38+
39+ steps :
40+ - uses : actions/checkout@v4
41+
42+ - name : versioning and tagging
43+ id : tag_version
44+ uses :
mathieudutour/[email protected] 45+ with :
46+ github_token : ${{ secrets.GITHUB_TOKEN }}
47+
48+ - name : releasing
49+ uses : ncipollo/release-action@v1
50+ with :
51+ tag : ${{ steps.tag_version.outputs.new_tag }}
52+ name : ${{ steps.tag_version.outputs.new_tag }}
53+ body : ${{ steps.tag_version.outputs.changelog }}
54+ build-image :
55+ name : 도커 이미지 빌드
56+ runs-on : ubuntu-latest
57+ needs : [ codetest,tagging ]
58+
59+ permissions :
60+ contents : read
61+ packages : write
62+ attestations : write
63+ id-token : write
64+
65+ steps :
66+
67+ - name : Check out Repository
68+ uses : actions/checkout@v4
69+
70+ - name : Sign in github container registry
71+ uses : docker/login-action@v3
72+ with :
73+ registry : ${{env.REGISTRY}}
74+ username : ${{github.actor}}
75+ password : ${{secrets.GITHUB_TOKEN}}
76+ - name : Extract metadata
77+ uses : docker/metadata-action@v5
78+ with :
79+ images : ${{env.REGISTRY}}/${{env.IMAGE_NAME}}
80+ tags :
81+ type=sha
82+ type=raw,value=${{needs.tagging.outputs.tag_name}}
83+ type=raw,value=latest
84+
85+ - name : Build and Push Image
86+ uses : docker/build-push-action@v6
87+ with :
88+ context : .
89+ push : ' true'
90+ tags : ${{steps.meta.outputs.tags}}
91+ labels : ${{steps.meta.outputs.labels}}
0 commit comments