This repository has been archived by the owner on Mar 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (64 loc) · 2.19 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
76
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
# Repo Actions 페이지에 나타날 이름 (묶음)
name: Java CI with Gradle
# Event Trigger
# Master에 push, pull_request 될 경우 동작
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
# 실행 환경 OS 지정
runs-on: ubuntu-latest
# Task의 sequence를 명시
# Name은 Task의 이름, run은 실행될 코드
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
# 전송할 파일을 담을 디렉토리 생성
- name: Make Directory for deliver
run: mkdir deploy
# Jar 파일 Copy
- name: Copy Jar
run: cp ./build/libs/*.jar ./deploy/
# appspec.yml Copy
- name: Copy appspec
run: cp appspec.yml ./deploy/
# 압축파일 형태로 전달
- name: Make zip file
run: zip -r -qq -j ./springboot-build.zip ./deploy
# S3 Bucket으로 copy
- name: Deliver to AWS S3
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} # IAM key
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} # IAM key
# s3://{전달할 S3 Bucket 이름}/
run: |
aws s3 cp \
--region ap-northeast-2 \
--acl private \
./springboot-build.zip s3://bucket.h/
# deploy
- name: Deploy
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
aws deploy create-deployment \
--application-name codedeploy-h \
--deployment-group-name group \
--file-exists-behavior OVERWRITE \
--s3-location bucket=bucket.h,bundleType=zip,key=springboot-build.zip \
--region ap-northeast-2