-
Notifications
You must be signed in to change notification settings - Fork 2
82 lines (69 loc) · 2.7 KB
/
release-deploy.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
# This is a basic workflow to help you get started with Actions
name: release-deploy
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "Develop" branch
push:
branches: [ "Release" ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
deploy:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
with:
token: ${{ secrets.TOKEN }}
submodules: true
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin' # https://github.com/actions/setup-java
- 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-
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
shell: bash
- name: Build with Gradle
run: ./gradlew clean build -x test --info
shell: bash
- name: Test with Gradle
run: ./gradlew test
- name: zip 파일 생성
run: |
mkdir -p before-deploy
cp service-scripts/*.sh before-deploy/
cp appspec.yml before-deploy/
cp $(ls -tr build/libs/*.jar | tail -n 1) before-deploy/
cd before-deploy && zip -r before-deploy *
cd ../ && mkdir -p deploy
mv before-deploy/before-deploy.zip deploy/todoary-service$GITHUB_SHA.zip
shell: bash
- name: AWS 자격 증명
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }}
aws-region: ap-northeast-2
- name: S3 로드
run: |
aws s3 cp \
--region ap-northeast-2 \
./deploy/todoary-service$GITHUB_SHA.zip s3://todoary-service-s3/artifacts/todoary-service$GITHUB_SHA.zip
- name: CodeDeploy 배포
run: |
aws deploy create-deployment \
--application-name todoary-service \
--deployment-group-name todoary-service-group \
--s3-location bucket=todoary-service-s3,bundleType=zip,key=artifacts/todoary-service$GITHUB_SHA.zip