-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (50 loc) · 1.76 KB
/
Copy pathcd.yml
File metadata and controls
59 lines (50 loc) · 1.76 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
59
name: Deploy to Elastic Beanstalk
on:
pull_request:
types: [closed]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Create Dockerrun.aws.json
run: |
cat > Dockerrun.aws.json <<EOF
{
"AWSEBDockerrunVersion": "1",
"Image": {
"Name": "${{ secrets.DOCKER_USERNAME }}/sample-app:gha",
"Update": "true"
},
"Ports": [
{
"ContainerPort": "3000"
}
]
}
EOF
- name: Create deployment package
run: zip deploy_package.zip Dockerrun.aws.json
- name: Install AWS CLI
run: |
sudo apt-get update
sudo apt-get install -y python3-pip
pip3 install --user awscli
- 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-southeast-2
- name: Upload package to S3 bucket
run: aws s3 cp deploy_package.zip s3://elasticbeanstalk-ap-southeast-2-975050135764/EBApptest/
- name: Deploy to Elastic Beanstalk
run: |
aws elasticbeanstalk create-application-version \
--application-name sample-docker-react \
--version-label ${{ github.sha }} \
--source-bundle S3Bucket="elasticbeanstalk-ap-southeast-2-975050135764",S3Key="EBApptest/deploy_package.zip"
aws elasticbeanstalk update-environment \
--environment-name Sample-docker-react-env \
--version-label ${{ github.sha }}