-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (82 loc) · 2.92 KB
/
dev-CD.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: Push Image to Amazon ECR
on:
push:
branches:
- dev
env:
AWS_REGION: ap-northeast-2
ECR_REPOSITORY: ${{ secrets.ECR_REPOSITORY }}
GITHUB_SHA_FIX: ${{ github.sha }}
jobs:
build:
# ubuntu 버전 지정
runs-on: ubuntu-22.04
steps:
# Checkout 진행
- uses: actions/checkout@v3
# JDK 11 설치
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
# Gradle 캐싱
- name: Gradle Caching
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
# Gradle 권한 부여
- name: Grant execute permission for gradlew
run: chmod +x gradlew
# FCM 서비스 계정 키 적용
- name: Make firebase-service-key.json
run: |
cd ./src/main/resources
mkdir firebase
cd firebase
touch ./firebase-service-key.json
echo "${{ secrets.FIREBASE_RELEASE_ADMIN }}" | openssl base64 -d -A > ./firebase-service-key.json
shell: bash
# secret.yml 반영
- name: Make application-secret.yml
run: |
cd ./src/main/resources
touch ./application-secret.yml
echo "${{ secrets.APPLICATION_SECRET }}" > ./application-secret.yml
shell: bash
# dev.yml 반영
- name: Make application-dev.yml
run: |
cd ./src/main/resources
echo "${{ secrets.APPLICATION_DEV }}" > ./application-release.yml
shell: bash
# Gradle BootJar
- name: BootJar with Gradle
run: ./gradlew clean bootJar -Dspring.profiles.active=dev
# Configure AWS Credentials by using IAM inform
# - name: Configure AWS credentials
# uses: aws-actions/configure-aws-credentials@v1
# with:
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }} # 나의 ECR 정보
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# aws-region: ${{ env.AWS_REGION }}
# Login to ECR
# - name: Login to Amazon ECR
# id: login-ecr
# uses: aws-actions/amazon-ecr-login@v1
# Docker Image Push to ECR and Run container with Image pull from ECR
# - name: Build, tag, and push image to Amazon ECR
# id: build-image
# env:
# ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
# IMAGE_TAG: ${{ env.GITHUB_SHA_FIX }}
# run: |
# # Build a docker container and push it to ECR so that it can be deployed to ECS.
# docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
# docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
# echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"