-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (52 loc) · 1.92 KB
/
main.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
name: Development deployment from Github to AWS
on:
push:
branches:
- development
jobs:
deploy-docker-image:
runs-on: ubuntu-latest
steps:
- name: Checkout Latest Repo
uses: actions/checkout@master
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
push: true
tags: siddharth9903/seistart:latest
deploy-docker-image-to-aws-eb:
needs: deploy-docker-image
runs-on: ubuntu-latest
steps:
- name: Get timestamp
uses: gerred/[email protected]
id: current-time
- name: Run string replace
uses: frabert/replace-string-action@v2
id: format-time
with:
pattern: '[:\.]+'
string: "${{ steps.current-time.outputs.time }}"
replace-with: "-"
flags: "g"
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-skip-session-tagging: true
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-south-1
- name: Deploy to Elastic Beanstalk
run: |
version_label="$GITHUB_SHA-${{ steps.format-time.outputs.outputs.replaced }}"
aws elasticbeanstalk create-application-version --application-name Gateway --version-label "$version_label" --source-bundle S3Bucket=docker-login-bucket-seistart,S3Key=Dockerrun.aws.json
aws elasticbeanstalk update-environment --application-name Gateway --environment-name seistart-docker-dev --version-label "$version_label"