-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (61 loc) · 2.68 KB
/
prod-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
name: github-action
# 해당 workflow가 언제 실행될 것인지에 대한 트리거를 지정 qqe
on:
pull_request:
branches:
- prod-deploy
# 수동으로 해당 workflow 실행 지정
workflow_dispatch:
# workflow는 한개 이상의 job을 가지며, 각 job은 여러 step에 따라 단계를 나눌 수 있습니다.3
env:
S3_BUCKET_NAME: runway-codedeploy
AWS_REGION: ap-northeast-2
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- run: touch ./src/main/resources/application.properties
- run: echo "${{ secrets.APPLICATION }}" > ./src/main/resources/application.properties
- run: cat ./src/main/resources/application.properties
- run: touch ./src/main/resources/AuthKey_3374Y294XA.p8
- run: echo "${{ secrets.AUTH_KEY }}" > ./src/main/resources/AuthKey_3374Y294XA.p8
- run: cat ./src/main/resources/AuthKey_3374Y294XA.p8
- run: touch ./src/main/resources/application-prod.properties
- run: echo "${{ secrets.APPLICATION_PROD }}" > ./src/main/resources/application-prod.properties
- run: cat ./src/main/resources/application-prod.properties
- name: create-fcm-json
id: create-fcm-json
uses: jsdaniell/[email protected]
with:
name: "runwayAccessKey.json"
json: ${{ secrets.FCM_JSON }}
dir: "./src/main/resources/"
# - run: touch ./src/main/resources/runwayAccessKey.json
# - run: echo $runwayAccessKey.json > ./src/main/resources/runwayAccessKey.json
# - run: cat ./src/main/resources/runwayAccessKey.json
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
shell: bash
- name: Build with Gradle
run: ./gradlew clean build
shell: bash
- name: Make zip file
run: zip -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: ap-northeast-2
- name: Upload to S3
run: aws s3 cp --region ap-northeast-2 ./$GITHUB_SHA.zip s3://runway-codedeploy/$GITHUB_SHA.zip
- name: Code Deploy
run: aws deploy create-deployment --application-name runway-codedeploy --deployment-config-name CodeDeployDefault.AllAtOnce --deployment-group-name githubactions --s3-location bucket=runway-codedeploy,bundleType=zip,key=$GITHUB_SHA.zip