Skip to content

Commit

Permalink
feat: add capability to customize ecr repo name
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasbriere1 committed Feb 2, 2024
1 parent 620087c commit ddd2ddb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/push-image-ghcr-to-ecr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
ecr_url:
required: false
type: string
ecr_repository_name:
required: false
type: string
image_name:
required: true
type: string
Expand Down Expand Up @@ -68,7 +71,8 @@ jobs:
- name: Manipulate Image
env:
ECR_DEFAULT_URL: ${{ env.AWS_ACCOUNT_ID }}.dkr.ecr.${{ env.AWS_REGION }}.amazonaws.com
ECR_DEFAULT_REPOSITORY_NAME: ${{ inputs.environment_name }}/${{ inputs.image_name }}
run: |
docker pull ${{ inputs.image_url}}
docker tag ${{ inputs.image_url}} ${{ inputs.ecr_url || env.ECR_DEFAULT_URL }}/${{ inputs.environment_name }}/${{ inputs.image_name }}:${{ inputs.releasetag }}
docker push ${{ inputs.ecr_url || env.ECR_DEFAULT_URL }}/${{ inputs.environment_name }}/${{ inputs.image_name }}:${{ inputs.releasetag }}
docker tag ${{ inputs.image_url}} ${{ inputs.ecr_url || env.ECR_DEFAULT_URL }}/${{ inputs.ecr_repository_name || env.ECR_DEFAULT_REPOSITORY_NAME }}:${{ inputs.releasetag }}
docker push ${{ inputs.ecr_url || env.ECR_DEFAULT_URL }}/${{ inputs.ecr_repository_name || env.ECR_DEFAULT_REPOSITORY_NAME }}:${{ inputs.releasetag }}

0 comments on commit ddd2ddb

Please sign in to comment.