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 --no-daemon
30+
31+ tagging :
32+ name : 태깅 및 릴리즈
33+ runs-on : ubuntu-latest
34+ outputs :
35+ tag_name : ${{ steps.tag_version.outputs.new_tag }}
36+
37+ steps :
38+ - uses : actions/checkout@v4
39+
40+ - name : versioning and tagging
41+ id : tag_version
42+ uses :
mathieudutour/[email protected] 43+ with :
44+ github_token : ${{ secrets.GITHUB_TOKEN }}
45+
46+ - name : releasing
47+ uses : ncipollo/release-action@v1
48+ with :
49+ tag : ${{ steps.tag_version.outputs.new_tag }}
50+ name : ${{ steps.tag_version.outputs.new_tag }}
51+ body : ${{ steps.tag_version.outputs.changelog }}
52+ build-image :
53+ name : 도커 이미지 빌드
54+ runs-on : ubuntu-latest
55+ needs : [ codetest,tagging ]
56+
57+ permissions :
58+ contents : read
59+ packages : write
60+ attestations : write
61+ id-token : write
62+
63+ steps :
64+
65+ - name : Check out Repository
66+ uses : actions/checkout@v4
67+
68+ - name : Sign in github container registry
69+ uses : docker/login-action@v3
70+ with :
71+ registry : ${{env.REGISTRY}}
72+ username : ${{github.actor}}
73+ password : ${{secrets.GITHUB_TOKEN}}
74+ - name : Extract metadata
75+ uses : docker/metadata-action@v5
76+ with :
77+ images : ${{env.REGISTRY}}/${{env.IMAGE_NAME}}
78+ tags :
79+ type=sha
80+ type=raw,value=${{needs.tagging.outputs.tag_name}}
81+ type=raw,value=latest
82+
83+ - name : Build and Push Image
84+ uses : docker/build-push-action@v6
85+ with :
86+ context : .
87+ push : ' true'
88+ tags : ${{steps.meta.outputs.tags}}
89+ labels : ${{steps.meta.outputs.labels}}
0 commit comments