Skip to content

Commit

Permalink
new beanstalk workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
npinak committed Mar 31, 2024
1 parent 798b22d commit 457e701
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 25 deletions.
57 changes: 32 additions & 25 deletions .github/workflows/deploy-aws.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,56 @@
name: Deploy React Book App from GitHub to AWS Elastic Beanstalk
name: Dev deployment from Github to AWS
on:
# activates the workflow when there is a push on the main branch
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest # the OS your job should run on
strategy:
matrix:
node-version: [16.x]
runs-on: ubuntu-latest
steps:
- name: Checkout Latest Repo
# checks out your repository under the GitHub workspace so that your workflow can access it
uses: actions/checkout@v2
uses: actions/checkout@master

- name: Generate Deployment Package
# zip all files except .git
run: zip -r BookAppFrontend.zip * -x "**.git**"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Get timestamp
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile.prod
push: true
tags: VideoChat-Productivity-React-Firebase/VideoChat:latest

- name: Get Timestamp
uses: gerred/actions/current-time@master
id: current-time

- name: Run string replace
- name: Run String Replace
uses: frabert/replace-string-action@master
id: format-time
with:
# replaces '[:\.]+' in the timestamp with '-'
pattern: '[:\.]+'
string: "${{ steps.current-time.outputs.time }}"
replace-with: "-"
flags: "g"

- name: Generate Deployment Package
run: zip -r deploy.zip * -x "**node_modules**"

- name: Deploy to EB
uses: einaregilsson/beanstalk-deploy@v21
uses: einaregilsson/beanstalk-deploy@v16
with:
# input the credentials you used to setup AWS CLI and credentials for the application environment
aws_access_key: "${{ secrets.AWS_ACCESS_KEY_ID }}"
aws_secret_key: "${{ secrets.AWS_SECRET_ACCESS_KEY}}"
application_name: ProductivityChat
environment_name: ProductivityChat-env
version_label: "app-${{ steps.format-time.outputs.replaced }}"
aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
application_name: VideoChat
environment_name: VideoChat-env
version_label: "docker-app-${{ steps.format-time.outputs.replaced }}"
region: us-east-1
deployment_package: BookAppFrontend.zip

- name: Deployed!
run: echo App deployed to ELB
deployment_package: deploy.zip
Empty file added Dockerrun.aws.json
Empty file.

0 comments on commit 457e701

Please sign in to comment.