1
- name : ttakkeun dev CI/CD
2
-
3
- on :
4
- pull_request :
5
- types : [closed] # merge가 됐을 때 작동하도록 함
6
- workflow_dispatch : # (2).수동 실행도 가능하도록
7
-
8
- jobs :
9
- build :
10
- runs-on : ubuntu-latest # (3).OS환경
11
- if : github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'develop'
12
- # develop 브랜치에 merge가 됐을 때 작동하도록 설정
13
-
14
- steps :
15
- - name : Checkout # 위에서 기재한 develop 브랜치의 코드를 가져옴
16
- uses : actions/checkout@v2 # (4).코드 check out
17
-
18
- - name : Set up JDK 17 # 깃허브 자체적으로 자바 jdk를 설치함
19
- uses : actions/setup-java@v3
20
- with :
21
- java-version : 17 # (5).자바 설치
22
- distribution : ' adopt'
23
-
24
- - name : Grant execute permission for gradlew # gradle이 들어갈 대상에 권한을 부여함
25
- run : chmod +x ./gradlew
26
- shell : bash # (6).권한 부여
27
-
28
- - name : Build with Gradle
29
- run : ./gradlew clean build -x test
30
- shell : bash # (7).build시작
31
- # (5), (6), (7) - Github Actions를 이용해서 Jar 파일을 만드는 과정
32
-
33
- - name : Get current time
34
- uses : 1466587594/get-current-time@v2
35
- id : current-time
36
- with :
37
- format : YYYY-MM-DDTHH-mm-ss
38
- utcOffset : " +09:00" # (8).build시점의 시간확보
39
-
40
- - name : Show Current Time
41
- run : echo "CurrentTime=$"
42
- shell : bash # (9).확보한 시간 보여주기
43
- # (8), (9) - 타임스탬프를 기록하기 위한 과정
44
-
45
- - name : Generate deployment package
46
- run : |
47
- mkdir -p deploy
48
- cp build/libs/*.jar deploy/application.jar
49
- cp Procfile deploy/Procfile
50
- cp -r .ebextensions-dev deploy/.ebextensions
51
- cp -r .platform deploy/.platform
52
- cd deploy && zip -r deploy.zip .
53
- # Github Action을 통해 깃허브가 자체적으로 리눅스 가상 환경을 만들어서
54
- # 배포에 필요한 빌드 과정을 진행하는 과정
55
-
56
- - name : List deploy directory contents
57
- run : |
58
- echo "Contents of deploy directory:"
59
- ls -R deploy
60
- shell : bash
61
-
62
- - name : Check nginx.conf existence
63
- run : |
64
- if [ -f deploy/.platform/nginx.conf ]; then
65
- echo "nginx.conf found"
66
- else
67
- echo "nginx.conf not found"
68
- exit 1
69
- fi
70
- shell : bash
71
- # nginx 상태 점검용 코드 추가
72
-
73
- - name : Unzip deploy package
74
- run : |
75
- unzip deploy/deploy.zip -d deploy/unzipped
76
- echo "Contents of unzipped deploy directory:"
77
- ls -R deploy/unzipped
78
- shell : bash
79
- # deploy.zip 파일 내 내용 확인
80
-
81
- - name : Beanstalk Deploy
82
- uses : einaregilsson/beanstalk-deploy@v21
83
- with :
84
- aws_access_key : ${{ secrets.AWS_ACTION_ACCESS_KEY_ID }} # 깃허브에 secrets로 설정함
85
- aws_secret_key : ${{ secrets.AWS_ACTION_SECRET_ACCESS_KEY }} # 깃허브에 secrets로 설정함
86
- application_name : umc-ttakkeun-dev
87
- environment_name : Umc-ttakkeun-dev-env # Elastic Beanstalk명
88
- version_label : github-action-${{ steps.current-time.outputs.formattedTime }} # 타임스탬프
89
- region : ap-northeast-2
90
- deployment_package : deploy/deploy.zip
91
- wait_for_deployment : false
92
- # Elastic beanstalk에 배포 요청
1
+ # name: ttakkeun dev CI/CD
2
+ #
3
+ # on:
4
+ # pull_request:
5
+ # types: [closed] # merge가 됐을 때 작동하도록 함
6
+ # workflow_dispatch: # (2).수동 실행도 가능하도록
7
+ #
8
+ # jobs:
9
+ # build:
10
+ # runs-on: ubuntu-latest # (3).OS환경
11
+ # if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'develop'
12
+ # # develop 브랜치에 merge가 됐을 때 작동하도록 설정
13
+ #
14
+ # steps:
15
+ # - name: Checkout # 위에서 기재한 develop 브랜치의 코드를 가져옴
16
+ # uses: actions/checkout@v2 # (4).코드 check out
17
+ #
18
+ # - name: Set up JDK 17 # 깃허브 자체적으로 자바 jdk를 설치함
19
+ # uses: actions/setup-java@v3
20
+ # with:
21
+ # java-version: 17 # (5).자바 설치
22
+ # distribution: 'adopt'
23
+ #
24
+ # - name: Grant execute permission for gradlew # gradle이 들어갈 대상에 권한을 부여함
25
+ # run: chmod +x ./gradlew
26
+ # shell: bash # (6).권한 부여
27
+ #
28
+ # - name: Build with Gradle
29
+ # run: ./gradlew clean build -x test
30
+ # shell: bash # (7).build시작
31
+ # # (5), (6), (7) - Github Actions를 이용해서 Jar 파일을 만드는 과정
32
+ #
33
+ # - name: Get current time
34
+ # uses: 1466587594/get-current-time@v2
35
+ # id: current-time
36
+ # with:
37
+ # format: YYYY-MM-DDTHH-mm-ss
38
+ # utcOffset: "+09:00" # (8).build시점의 시간확보
39
+ #
40
+ # - name: Show Current Time
41
+ # run: echo "CurrentTime=$"
42
+ # shell: bash # (9).확보한 시간 보여주기
43
+ # # (8), (9) - 타임스탬프를 기록하기 위한 과정
44
+ #
45
+ # - name: Generate deployment package
46
+ # run: |
47
+ # mkdir -p deploy
48
+ # cp build/libs/*.jar deploy/application.jar
49
+ # cp Procfile deploy/Procfile
50
+ # cp -r .ebextensions-dev deploy/.ebextensions
51
+ # cp -r .platform deploy/.platform
52
+ # cd deploy && zip -r deploy.zip .
53
+ # # Github Action을 통해 깃허브가 자체적으로 리눅스 가상 환경을 만들어서
54
+ # # 배포에 필요한 빌드 과정을 진행하는 과정
55
+ #
56
+ # - name: List deploy directory contents
57
+ # run: |
58
+ # echo "Contents of deploy directory:"
59
+ # ls -R deploy
60
+ # shell: bash
61
+ #
62
+ # - name: Check nginx.conf existence
63
+ # run: |
64
+ # if [ -f deploy/.platform/nginx.conf ]; then
65
+ # echo "nginx.conf found"
66
+ # else
67
+ # echo "nginx.conf not found"
68
+ # exit 1
69
+ # fi
70
+ # shell: bash
71
+ # # nginx 상태 점검용 코드 추가
72
+ #
73
+ # - name: Unzip deploy package
74
+ # run: |
75
+ # unzip deploy/deploy.zip -d deploy/unzipped
76
+ # echo "Contents of unzipped deploy directory:"
77
+ # ls -R deploy/unzipped
78
+ # shell: bash
79
+ # # deploy.zip 파일 내 내용 확인
80
+ #
81
+ # - name: Beanstalk Deploy
82
+ # uses: einaregilsson/beanstalk-deploy@v21
83
+ # with:
84
+ # aws_access_key: ${{ secrets.AWS_ACTION_ACCESS_KEY_ID }} # 깃허브에 secrets로 설정함
85
+ # aws_secret_key: ${{ secrets.AWS_ACTION_SECRET_ACCESS_KEY }} # 깃허브에 secrets로 설정함
86
+ # application_name: umc-ttakkeun-dev
87
+ # environment_name: Umc-ttakkeun-dev-env # Elastic Beanstalk명
88
+ # version_label: github-action-${{ steps.current-time.outputs.formattedTime }} # 타임스탬프
89
+ # region: ap-northeast-2
90
+ # deployment_package: deploy/deploy.zip
91
+ # wait_for_deployment: false
92
+ # # Elastic beanstalk에 배포 요청
0 commit comments