-
Notifications
You must be signed in to change notification settings - Fork 0
36 lines (36 loc) · 1.42 KB
/
deploy.yml
File metadata and controls
36 lines (36 loc) · 1.42 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
name: SpringBoot APP CI/CD
on:
push:
branches: [ main ]
jobs:
deploy:
name: Build Image
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
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, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: commitmon
IMAGE_TAG: ${{ github.run_number }}
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -t $ECR_REGISTRY/$ECR_REPOSITORY:latest .
docker push $ECR_REGISTRY/$ECR_REPOSITORY --all-tags
- name: Deploy to Amazon EC2
run: |
aws deploy create-deployment \
--application-name ${{ secrets.AWS_CODE_DEPLOY_APPLICATION }} \
--deployment-config-name CodeDeployDefault.OneAtATime \
--deployment-group-name ${{ secrets.AWS_CODE_DEPLOY_GROUP }} \
--description "Deploy commitmon" \
--s3-location bucket=${{ secrets.AWS_S3_BUCKET_NAME }},key=${{ secrets.AWS_REVISION_S3_KEY }},bundleType=tar