From d2e16d46489f229790647e7ce0504b77c137e463 Mon Sep 17 00:00:00 2001 From: Siddharth Patel Date: Tue, 12 Mar 2024 02:32:14 +0530 Subject: [PATCH] version including github sha and time --- .github/workflows/main.yml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 782f929..3feb704 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -33,6 +33,19 @@ jobs: runs-on: ubuntu-latest steps: + - name: Get timestamp + uses: gerred/actions/current-time@master + 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: @@ -43,5 +56,6 @@ jobs: - name: Deploy to Elastic Beanstalk run: | - aws elasticbeanstalk create-application-version --application-name Gateway --version-label $GITHUB_SHA --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 $GITHUB_SHA + 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"