File tree Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change 95
95
service : ${{ env.ECS_SERVICE }}
96
96
cluster : ${{ env.ECS_CLUSTER }}
97
97
wait-for-service-stability : true
98
- # Output the app URL
98
+ # Output the app URL
99
+ - name : Set App IP
100
+ id : set_app_ip
101
+ run : |
102
+ TASK_ARN=$(aws ecs list-tasks --cluster "${ECS_CLUSTER}" --service-name "${ECS_SERVICE}" --query 'taskArns[0]' --output text)
103
+ TASK_DETAILS=$(aws ecs describe-tasks --cluster "${ECS_CLUSTER}" --task "${TASK_ARN}" --query 'tasks[0].attachments[0].details')
104
+ ENI=$(echo $TASK_DETAILS | jq -r '.[] | select(.name=="networkInterfaceId").value')
105
+ PUBLIC_IP=$(aws ec2 describe-network-interfaces --network-interface-ids "${ENI}" --query 'NetworkInterfaces[0].Association.PublicIp' --output text)
106
+ echo "app_ip=$PUBLIC_IP" >> $GITHUB_OUTPUT
107
+
108
+ - name : Set App URL
109
+ id : set_app_url
110
+ run : |
111
+ TARGET_GROUP_ARN=$(aws ecs describe-services --service "${ECS_SERVICE}" --cluster "${ECS_CLUSTER}" --query 'services[0].loadBalancers[0].targetGroupArn' --output text)
112
+ LOAD_BALANCER_ARN=$(aws elbv2 describe-target-groups --target-group-arns $TARGET_GROUP_ARN --query 'TargetGroups[0].LoadBalancerArns[0]' --output text)
113
+ APP_URL=$(aws elbv2 describe-load-balancers --load-balancer-arns $LOAD_BALANCER_ARN --query 'LoadBalancers[0].DNSName' --output text)
114
+ echo "app_url=$APP_URL" >> $GITHUB_OUTPUT
115
+
116
+ - name : Summary
117
+ id : summary
118
+ run : |
119
+ echo "" >> $GITHUB_STEP_SUMMARY # this is a blank line
120
+ echo "## ECS Task" >> $GITHUB_STEP_SUMMARY
121
+ echo "* App URL: http://${{ steps.set_app_url.outputs.APP_URL }}" >> $GITHUB_STEP_SUMMARY
122
+ echo "" >> $GITHUB_STEP_SUMMARY # this is a blank line
You can’t perform that action at this time.
0 commit comments