time-version update #17
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Development deployment from Github to AWS | |
on: | |
push: | |
branches: | |
- testing | |
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" |