update flow for the docker image

This commit is contained in:
Vasilije 2023-09-04 20:51:15 +02:00
parent a04f2de58f
commit 27df32e421

View file

@ -23,38 +23,38 @@ jobs:
steps: steps:
- name: Take code from repo - name: Take code from repo
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Set environment variable for stage # - name: Set environment variable for stage
id: set-env # id: set-env
run: | # run: |
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then # if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
echo "STAGE=prd" >> $GITHUB_ENV # echo "STAGE=prd" >> $GITHUB_ENV
echo "::set-output name=stage::prd" # echo "::set-output name=stage::prd"
else # else
echo "STAGE=dev" >> $GITHUB_ENV # echo "STAGE=dev" >> $GITHUB_ENV
echo "::set-output name=stage::dev" # echo "::set-output name=stage::dev"
fi # fi
- name: Use output # - name: Use output
run: echo "The stage is ${{ steps.set-env.outputs.stage }}" # run: echo "The stage is ${{ steps.set-env.outputs.stage }}"
- name: Configure AWS credentials # - name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1 # uses: aws-actions/configure-aws-credentials@v1
with: # with:
role-to-assume: ${{ env.AWS_ROLE_DEV_CICD }} # role-to-assume: ${{ env.AWS_ROLE_DEV_CICD }}
aws-region: eu-west-1 # aws-region: eu-west-1
- name: Create Docker image and push to ECR # - name: Create Docker image and push to ECR
uses: ./.github/actions/image_builder # uses: ./.github/actions/image_builder
id: generate-promethai-docker # id: generate-promethai-docker
with: # with:
stage: prd # stage: prd
aws_account_id: ${{ env.AWS_ACCOUNT_ID_DEV }} # aws_account_id: ${{ env.AWS_ACCOUNT_ID_DEV }}
should_publish: true # should_publish: true
ecr_image_repo_name: promethai-prd-backend-promethai-backend-memory # ecr_image_repo_name: promethai-prd-backend-promethai-backend-memory
dockerfile_location: ./level_2 # dockerfile_location: ./level_2
- name: Export Docker image tag # - name: Export Docker image tag
id: export-promethai-docker-tag # id: export-promethai-docker-tag
run: | # run: |
export DOCKER_TAG=$(cat /tmp/.DOCKER_IMAGE_VERSION) # export DOCKER_TAG=$(cat /tmp/.DOCKER_IMAGE_VERSION)
echo "Docker tag is: $DOCKER_TAG" # echo "Docker tag is: $DOCKER_TAG"
echo "promethai_docker_tag_backend=$DOCKER_TAG" >> $GITHUB_OUTPUT # echo "promethai_docker_tag_backend=$DOCKER_TAG" >> $GITHUB_OUTPUT
# - name: Create Tag and Release # - name: Create Tag and Release
# runs-on: ubuntu-latest # runs-on: ubuntu-latest
@ -78,8 +78,8 @@ jobs:
# with: # with:
# tag_name: ${{ steps.bump_version_and_push_tag.outputs.tag }} # tag_name: ${{ steps.bump_version_and_push_tag.outputs.tag }}
# release_name: Release ${{ steps.bump_version_and_push_tag.outputs.tag }} # release_name: Release ${{ steps.bump_version_and_push_tag.outputs.tag }}
outputs: # outputs:
promethai_docker_tag_backend: ${{ steps.export-promethai-docker-tag.outputs.promethai_docker_tag_backend }} # promethai_docker_tag_backend: ${{ steps.export-promethai-docker-tag.outputs.promethai_docker_tag_backend }}
# apply_tf: # apply_tf:
# name: Trigger terraform apply workflow # name: Trigger terraform apply workflow