diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index 07c9bb8..deb20d2 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -42,9 +42,6 @@ jobs: id-token: write contents: write environment: ${{ needs.set-env-variable.outputs.ENVIRONMENT }} - env: - DEPLOY_ENV: ${{ needs.set-env-variable.outputs.ENVIRONMENT }} - ACCOUNT_NUMBER: ${{ needs.set-env-variable.outputs.ACCOUNT_NUMBER }} runs-on: ubuntu-latest steps: - name: Checkout @@ -58,14 +55,14 @@ jobs: pip install pipenv && \ pipenv install && \ pipenv run python ".github/taskdefinition_template/taskdef_creator.py" \ - .github/taskdef/${DEPLOY_ENV}-taskdef.yaml \ + .github/taskdef/${{ needs.set-env-variable.outputs.ENVIRONMENT }}-taskdef.yaml \ ".github/taskdefinition_template/taskdef_template.json" - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v1 with: aws-region: eu-west-1 - role-to-assume: arn:aws:iam::${ACCOUNT_NUMBER}:role/static-${DEPLOY_ENV}-GithubActionsRole + role-to-assume: arn:aws:iam::${{ needs.set-env-variable.outputs.ACCOUNT_NUMBER }}:role/static-${{ needs.set-env-variable.outputs.ENVIRONMENT }}-GithubActionsRole role-session-name: GithubActionsSession - name: Login to Amazon ECR @@ -77,7 +74,7 @@ jobs: env: ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} IMAGE_TAG: ${{ github.sha }} - ECR_REPOSITORY: "static-${DEPLOY_ENV}-ecr" + ECR_REPOSITORY: "static-${{ needs.set-env-variable.outputs.ENVIRONMENT }}-ecr" run: | docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG @@ -85,20 +82,20 @@ jobs: - name: Extract directory path run: | - echo "TASKDEF_FILE=".github/taskdef/static-${DEPLOY_ENV}.json" >> $GITHUB_ENV + echo "TASKDEF_FILE=".github/taskdef/static-${{ needs.set-env-variable.outputs.ENVIRONMENT }}.json" >> $GITHUB_ENV - name: Fill in the new image ID in the Amazon ECS task definition id: task-def uses: aws-actions/amazon-ecs-render-task-definition@v1 with: task-definition: "${{ env.TASKDEF_FILE }}" - container-name: "static-${DEPLOY_ENV}" + container-name: "static-${{ needs.set-env-variable.outputs.ENVIRONMENT }}" image: ${{ steps.build-image.outputs.image }} - name: Deploy Amazon ECS task definition uses: aws-actions/amazon-ecs-deploy-task-definition@v1 with: task-definition: ${{ steps.task-def.outputs.task-definition }} - service: "static-${DEPLOY_ENV}-ecs-service" - cluster: "static-${DEPLOY_ENV}-ecs-cluster" + service: "static-${{ needs.set-env-variable.outputs.ENVIRONMENT }}-ecs-service" + cluster: "static-${{ needs.set-env-variable.outputs.ENVIRONMENT }}-ecs-cluster" wait-for-service-stability: true