From e3f608dc175ea41e2ffcaec6008fe098edc390cd Mon Sep 17 00:00:00 2001 From: Sam Seed Date: Fri, 6 Oct 2023 17:35:56 +0100 Subject: [PATCH] Use GITHUB_ENV to store timestamp --- .github/workflows/aws_deploy.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/aws_deploy.yml b/.github/workflows/aws_deploy.yml index e3452768a..747620903 100644 --- a/.github/workflows/aws_deploy.yml +++ b/.github/workflows/aws_deploy.yml @@ -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"