|
|
|
@ -80,8 +80,7 @@ jobs:
|
|
|
|
|
|
|
|
|
|
- name: Get timestamp |
|
|
|
|
id: timestamp |
|
|
|
|
run: | |
|
|
|
|
echo "::set-output name=timestamp::$(echo "timestamp=$(date +%Y%m%d%H%M%S)")" |
|
|
|
|
run: echo "timestamp=$(date +%Y%m%d%H%M%S)" >> $GITHUB_ENV |
|
|
|
|
|
|
|
|
|
- name: Get latest release with tag |
|
|
|
|
id: latestrelease |
|
|
|
@ -104,13 +103,13 @@ jobs:
|
|
|
|
|
id: tags |
|
|
|
|
run: | |
|
|
|
|
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)" |
|
|
|
|
echo "::set-output name=additional-tag::$(if [[ ${{ inputs.environment == 'production' }} ]]; then echo ${{ steps.latestrelease.outputs.releasetag }}; else echo ${{ env.timestamp }}; fi)" |
|
|
|
|
|
|
|
|
|
- name: Add environment tag to existing image |
|
|
|
|
env: |
|
|
|
|
registry: ${{ steps.ecr-login.outputs.registry }} |
|
|
|
|
commit_tag: ${{ steps.tags.outputs.commit-tag }} |
|
|
|
|
readable_tag: ${{ inputs.environment }}-${{ steps.tags.outputs.additional-tag }}-${{ steps.timestamp.outputs.timestamp }} |
|
|
|
|
readable_tag: ${{ inputs.environment }}-${{ steps.tags.outputs.additional-tag }}-${{ env.timestamp }} |
|
|
|
|
run: | |
|
|
|
|
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" |
|
|
|
|