|
|
|
@ -82,7 +82,7 @@ jobs:
|
|
|
|
|
|
|
|
|
|
- name: Get timestamp |
|
|
|
|
id: timestamp |
|
|
|
|
run: echo "timestamp=$(date +%Y%m%d%H%M%S)" >> $GITHUB_OUTPUT |
|
|
|
|
run: echo "timestamp=$(date +%Y%m%d%H%M%S)" >> $GITHUB_ENV |
|
|
|
|
|
|
|
|
|
- name: Checkout at release tag |
|
|
|
|
uses: actions/checkout@v3 |
|
|
|
@ -93,19 +93,19 @@ jobs:
|
|
|
|
|
- name: Get tags |
|
|
|
|
id: tags |
|
|
|
|
run: | |
|
|
|
|
echo "commit-tag=$(if [[ ${{ inputs.environment }} == 'production' ]]; then echo $(git log -1 '--format=format:%H'); else echo ${{ github.sha }}; fi)" >> $GITHUB_OUTPUT |
|
|
|
|
echo "additional-tag=$(if [[ ${{ inputs.environment }} == 'production' ]]; then echo ${{ inputs.release_tag }}-${{ steps.timestamp.outputs.timestamp }}; else echo ${{ steps.timestamp.outputs.timestamp }}; fi)" >> $GITHUB_OUTPUT |
|
|
|
|
echo "commit-tag=$(if [[ ${{ inputs.environment }} == 'production' ]]; then echo $(git log -1 '--format=format:%H'); else echo ${{ github.sha }}; fi)" >> $GITHUB_ENV |
|
|
|
|
echo "additional-tag=$(if [[ ${{ inputs.environment }} == 'production' ]]; then echo ${{ inputs.release_tag }}-${{ env.timestamp }}; else echo ${{ env.timestamp }}; fi)" >> $GITHUB_ENV |
|
|
|
|
|
|
|
|
|
- name: Add environment tag to existing image |
|
|
|
|
id: update-image-tags |
|
|
|
|
env: |
|
|
|
|
registry: ${{ steps.ecr-login.outputs.registry }} |
|
|
|
|
commit_tag: ${{ steps.tags.outputs.commit-tag }} |
|
|
|
|
readable_tag: ${{ inputs.environment }}-${{ steps.tags.outputs.additional-tag }} |
|
|
|
|
commit_tag: ${{ env.commit-tag }} |
|
|
|
|
readable_tag: ${{ inputs.environment }}-${{ env.additional-tag }} |
|
|
|
|
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" |
|
|
|
|
echo "image=$registry/$repository:$readable_tag" >> $GITHUB_OUTPUT |
|
|
|
|
echo "image=$registry/$repository:$readable_tag" >> $GITHUB_ENV |
|
|
|
|
|
|
|
|
|
- name: Configure AWS credentials for environment |
|
|
|
|
uses: aws-actions/configure-aws-credentials@v3 |
|
|
|
@ -126,7 +126,7 @@ jobs:
|
|
|
|
|
with: |
|
|
|
|
task-definition: ad-hoc-task-definition.json |
|
|
|
|
container-name: app |
|
|
|
|
image: ${{ steps.update-image-tags.outputs.image }} |
|
|
|
|
image: ${{ env.image }} |
|
|
|
|
|
|
|
|
|
- name: Update ad hoc task definition |
|
|
|
|
uses: aws-actions/amazon-ecs-deploy-task-definition@v1 |
|
|
|
@ -161,7 +161,7 @@ jobs:
|
|
|
|
|
with: |
|
|
|
|
task-definition: app-task-definition.json |
|
|
|
|
container-name: app |
|
|
|
|
image: ${{ steps.update-image-tags.outputs.image }} |
|
|
|
|
image: ${{ env.image }} |
|
|
|
|
|
|
|
|
|
- name: Deploy updated application |
|
|
|
|
uses: aws-actions/amazon-ecs-deploy-task-definition@v1 |
|
|
|
@ -183,7 +183,7 @@ jobs:
|
|
|
|
|
with: |
|
|
|
|
task-definition: sidekiq-task-definition.json |
|
|
|
|
container-name: sidekiq |
|
|
|
|
image: ${{ steps.update-image-tags.outputs.image }} |
|
|
|
|
image: ${{ env.image }} |
|
|
|
|
|
|
|
|
|
- name: Deploy updated sidekiq |
|
|
|
|
uses: aws-actions/amazon-ecs-deploy-task-definition@v1 |
|
|
|
|