|
|
|
@ -101,22 +101,21 @@ jobs:
|
|
|
|
|
with: |
|
|
|
|
ref: ${{ steps.latestrelease.outputs.releasetag }} |
|
|
|
|
|
|
|
|
|
- name: Construct environment-dependent tag |
|
|
|
|
id: tag |
|
|
|
|
- name: Get tags |
|
|
|
|
id: tags |
|
|
|
|
run: | |
|
|
|
|
echo "::set-output name=tag::$(if [[ ${{ inputs.environment == 'production' }} ]]; then echo ${{ steps.latestrelease.outputs.releasetag }}; else echo ${{ steps.timestamp.outputs.timestamp }}; fi)" |
|
|
|
|
echo "::set-output name=commit-tag::$(if [[ ${{ inputs.environment == 'production' }} ]]; then echo $(git log -1 '--format=format:%H'); else echo ${{ github.sha }}; fi)" |
|
|
|
|
echo "::set-output name=additional-tag::$(if [[ ${{ inputs.environment == 'production' }} ]]; then echo ${{ steps.latestrelease.outputs.releasetag }}; else echo ${{ steps.timestamp.outputs.timestamp }}; fi)" |
|
|
|
|
|
|
|
|
|
- name: Add environment tag to existing image |
|
|
|
|
env: |
|
|
|
|
registry: ${{ steps.ecr-login.outputs.registry }} |
|
|
|
|
commit_tag: ${{ github.sha }} |
|
|
|
|
readable_tag: ${{ inputs.environment }}-${{ steps.tag.outputs.tag }} |
|
|
|
|
commit_tag: ${{ steps.tags.outputs.commit-tag }} |
|
|
|
|
readable_tag: ${{ inputs.environment }}-${{ steps.tags.outputs.additional-tag }} |
|
|
|
|
run: | |
|
|
|
|
echo $commit_tag |
|
|
|
|
echo $readable_tag |
|
|
|
|
manifest=$(aws ecr batch-get-image --repository-name $repository --image-ids imageTag=$commit_tag --output text --query images[].imageManifest) |
|
|
|
|
echo $manifest |
|
|
|
|
aws ecr put-image --repository-name $repository --image-tag $readable_tag --image-manifest "$manifest" |
|
|
|
|
echo "image=$registry/$repository:$readable_tag" >> $GITHUB_ENV |
|
|
|
|
# manifest=$(aws ecr batch-get-image --repository-name $repository --image-ids imageTag=$commit_tag --output text --query images[].imageManifest) |
|
|
|
|
# aws ecr put-image --repository-name $repository --image-tag $readable_tag --image-manifest "$manifest" |
|
|
|
|
# echo "image=$registry/$repository:$readable_tag" >> $GITHUB_ENV |
|
|
|
|