-
Notifications
You must be signed in to change notification settings - Fork 1
58 lines (57 loc) · 2.74 KB
/
api-cd-dev.yml
File metadata and controls
58 lines (57 loc) · 2.74 KB
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
name: api-cd-dev
on:
push:
branches:
- dev
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Cache Gradle
uses: actions/cache@v2
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
- 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: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Build and Push Docker image to Amazon ECR
run: |
./gradlew :api:jib \
-Djib.from.image=openjdk:17-jdk-slim \
-Djib.to.image=${{secrets.DEV_ECR_IMAGE}} \
-Djib.to.auth.username=AWS \
-Djib.to.auth.password=${{ steps.ecr-login.outputs.ecr-password }} \
-Djib.to.tags=dev \
-Djib.container.jvmFlags="-Dspring.profiles.active=dev,-Dfile.encoding=UTF-8,-Duser.timezone=Asia/Seoul" \
-Djib.container.environment="AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }},AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }}"
- name: Create new ElasticBeanstalk Application Version
run: |
aws elasticbeanstalk create-application-version \
--application-name ${{ secrets.DEV_EB_APPLICATION }} \
--source-bundle S3Bucket="dangle-legacy-api",S3Key="api/Legacy-Deploy.zip" \
--version-label "ver-${{ github.sha }}-${{ github.run_id }}-${{ github.run_attempt }}" \
--description "commit-sha-${{ github.sha }}"
- name: Deploy new ElasticBeanstalk Application Version
run: |
aws elasticbeanstalk update-environment \
--environment-name ${{ secrets.DEV_EB_ENVIRONMENT }} \
--version-label "ver-${{ github.sha }}-${{ github.run_id }}-${{ github.run_attempt }}"