-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (65 loc) · 1.93 KB
/
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
name: cd
on:
workflow_run:
workflows: [ ci ]
branches:
- develop
types:
- completed
env:
BUCKET_NAME: lingoswap-build
ARN: arn:aws:iam::285279154236:role/s3-codedeploy
AWS_REGION: ap-northeast-2
permissions:
id-token: write
contents: read
defaults:
run:
shell: bash
working-directory: .
jobs:
Deploy:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{secrets.ACCESS_TOKEN}}
submodules: true
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'semeru'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Change gradlew permissions
run: chmod +x ./gradlew
- name: Build with Gradle
run: ./gradlew bootJar
- name: Compress build files
run: |
zip -r -qq -j ./build.zip ./build/libs/*.jar ./appspec.yml ./execute-deploy.sh
- name: Configure aws credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ env.ARN }}
aws-region: ${{ env.AWS_REGION }}
- name: Upload to S3
run: |
aws s3 cp ./build.zip s3://${{ env.BUCKET_NAME }}/
- name: Code Deploy
run: aws deploy create-deployment --application-name lingoswap
--deployment-config-name CodeDeployDefault.OneAtATime
--deployment-group-name ec2
--s3-location bucket=${{ env.BUCKET_NAME }},bundleType=zip,key=build.zip