-
Notifications
You must be signed in to change notification settings - Fork 2
71 lines (58 loc) · 2.54 KB
/
code-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
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# 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://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle
name: Java CI with Gradle
on:
push:
branches: [ "master", "feat-codeDeploy" ]
pull_request:
branches: [ "master" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin' # https://github.com/actions/setup-java
## create env file
- name: create env file
run: |
cd ./src/main/resources
touch security.properties
echo "${{ secrets.PROPERTIES }}" > security.properties
## create firebase key
- name: create firebase key
run: |
cd ./src/main/resources
touch kimgreen-f33e5-firebase-adminsdk-63srz-6817b2eec4.json
echo "${{ secrets.FIREBASE_KEY }}" > kimgreen-f33e5-firebase-adminsdk-63srz-6817b2eec4.json
# 에러발생 : 권한부여
- name: Run chomod to make gradlew executable
run: chmod +x ./gradlew
# Build
- name: Build with Gradle
uses: gradle/gradle-build-action@0d13054264b0bb894ded474f08ebb30921341cee
with:
arguments: clean build -x test
# zip : 랜덤 파일명 위한 깃허브 기본환경변수 사용
- name: make zip file
run: zip -qq -r ./$GITHUB_SHA.zip .
shell: bash
- 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: ${{ secrets.AWS_REGION }}
- name: Upload to S3
run: aws s3 cp --region ${{ secrets.AWS_REGION }} ./$GITHUB_SHA.zip s3://${{ secrets.S3_BUCKET_NAME }}/$GITHUB_SHA.zip
- name: Code Deploy
run: aws deploy create-deployment --application-name ${{ secrets.AWS_APP_NAME }} --deployment-config-name CodeDeployDefault.AllAtOnce --deployment-group-name ${{ secrets.AWS_GROUP_NAME }} --s3-location bucket=${{ secrets.S3_BUCKET_NAME }},bundleType=zip,key=$GITHUB_SHA.zip