-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (64 loc) · 2.43 KB
/
gradle.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: Java CICD with Gradle & Docker
on:
pull_request:
types: [ closed ]
workflow_dispatch: # 수동 실행 가능
jobs:
build-and-push-image:
runs-on: ubuntu-latest
steps:
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Checkout
uses: actions/checkout@v3
# 환경 변수 설정 (0)
- name: Set Yaml
uses: microsoft/variable-substitution@v1
with:
files: ./src/main/resources/application.yml
env:
spring.datasource.url: ${{ secrets.DB_URL }}
spring.datasource.username: ${{ secrets.DB_USERNAME }}
spring.datasource.password: ${{ secrets.DB_PASSWORD }}
spring.jwt.secret: ${{ secrets.JWT_SECRET }}
spring.mail.password: ${{ secrets.GMAIL_PWD }}
# Spring Boot 어플리케이션 Build (1)
- name: Spring Boot Build
run: ./gradlew clean build -x test --warning-mode=all --stacktrace
# Docker 이미지 Build (2)
- name: docker image build
run: docker build -t rimi3226/gamegoo .
# DockerHub Login (3)
- name: docker login
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PW }}
# Docker Hub push (4)
- name: docker Hub push
run: docker push rimi3226/gamegoo
# Configure AWS Credentials (6) - AWS 접근 권한 취득(IAM)
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-northeast-2
# Build 번호 부여 (7)
- name: Build Number
id: build-number
run: echo "::set-output name=BUILD_NUMBER::$(date '+%-d.%-m.%Y.%-H.%-M.%-S')"
# Elastic Beanstalk Deploy with docker (8)
- name: Deploy to EB
uses: einaregilsson/beanstalk-deploy@v20
with:
aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
application_name: Gamegoo
environment_name: Gamegoo-env
region: ap-northeast-2
version_label: ${{ steps.build-number.outputs.BUILD_NUMBER }}
deployment_package: ./elasticbeanstalk/docker-compose.yml