Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 33 additions & 1 deletion .github/workflows/ci-server-.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
ECR_REPOSITORY: ${{ steps.set_env.outputs.ECR_REPOSITORY }}
ENVIRONMENT_BUCKET: ${{ steps.set_env.outputs.ENVIRONMENT_BUCKET }}
SLACK_WEBHOOK_URL: ${{ steps.vars.outputs.SLACK_WEBHOOK_URL }}
PUBLIC_CONDUCTOR_ECR: ${{ steps.vars.outputs.PUBLIC_CONDUCTOR_ECR}}

steps:
- id: vars
Expand All @@ -48,7 +49,7 @@ jobs:
case $BRANCH in
"dev")
ENV="dev"
;;
;;
"stg")
ENV="stg"
;;
Expand All @@ -75,6 +76,7 @@ jobs:
echo "AWS_ROLE=DEV_AWS_ROLE" >> $GITHUB_OUTPUT
echo "PROJECT_PREFIX=sirn-dev-mb" >> $GITHUB_OUTPUT
echo "SLACK_WEBHOOK_URL=DEV_SLACK_WEBHOOK_URL" >> $GITHUB_OUTPUT
echo "PUBLIC_CONDUCTOR_ECR=sandbox-conductor-server" >> $GITHUB_OUTPUT
else
echo "Branch not configured!"
exit 1
Expand Down Expand Up @@ -108,6 +110,7 @@ jobs:
ECR_REPOSITORY: ${{needs.prepare-env.outputs.ECR_REPOSITORY}}
ENVIRONMENT_BUCKET: ${{needs.prepare-env.outputs.ENVIRONMENT_BUCKET}}
IMAGE_TAG: ${{ github.event.inputs.tag }}
PUBLIC_CONDUCTOR_ECR: ${{needs.prepare-env.outputs.PUBLIC_CONDUCTOR_ECR}}
outputs:
ECR_REPO: ${{ steps.build.outputs.ECR_REPO }}
APP_IMAGE: ${{ steps.image.outputs.APP_IMAGE }}
Expand Down Expand Up @@ -151,6 +154,35 @@ jobs:
platforms: linux/amd64
tags: ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }}

- name: Configure AWS credentials for Public ECR
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we need as a separate yaml and call from here for better organising.

if: ${{ env.ENV == 'dev'}}
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets[env.AWS_ROLE] }}
aws-region: us-east-1

- name: Login to Amazon ECR Public
if: ${{ env.ENV == 'dev'}}
id: login-ecr-public
uses: aws-actions/amazon-ecr-login@v2
with:
registry-type: public

- name: Build and push to Public ECR
if: ${{ env.ENV == 'dev'}}
id: build-public
uses: docker/build-push-action@v5.1.0
env:
PUBLIC_REGISTRY: ${{ steps.login-ecr-public.outputs.registry }}
PUBLIC_REGISTRY_ALIAS: kvsiren-${{ env.ENV }}
with:
context: .
file: ./Dockerfile
push: true
provenance: false
platforms: linux/amd64
tags: ${{ env.PUBLIC_REGISTRY }}/${{ env.PUBLIC_REGISTRY_ALIAS }}/${{ env.PUBLIC_CONDUCTOR_ECR }}:${{ env.IMAGE_TAG }}

- name: Image name
id: image
env:
Expand Down