Open luisgj opened 1 year ago
Until support for start-deployment is added I am having to do this. Hope it helps someone and I hope they add this feature soon.
`
name: Deploy App Runner Image
id: deployapi
run: |
id=$(aws apprunner start-deployment --service-arn ${{ secrets.SERVICE_ARN }})
read opid < <(echo ${id} | jq -r '.OperationId' | tr -d '\r')
export status="IN_PROGRESS"
while [ "$status" == "IN_PROGRESS" ]; do
export status=$(aws apprunner list-operations --service-arn ${{ secrets.SERVICE_ARN }} --max-results 1 | jq -r '.OperationSummaryList[0].Status' | tr -d '\r');
echo "waiting..."
sleep 10
done
echo "Deploy has completed. Checking if it was successful."
results=$(aws apprunner list-operations --service-arn ${{ secrets.SERVICE_ARN }} --max-results 1)
read resultid < <(echo ${results} | jq -r '.OperationSummaryList[0].Id')
read resultstatus < <(echo ${results} | jq -r '.OperationSummaryList[0].Status' | tr -d '\r')
if [[ "${opid}" != "${resultid}" && ${resultstatus} != 'SUCCEEDED' ]]; then
echo "Deploy is showing a failure. Please check your configuration and try again."
echo "ID from start-deployment command: ${opid}"
echo "Most recent ID from list-operations command: ${resultid}"
echo "Most recent result status from list-operations command: ${resultstatus}"
echo "DEPLOYFAILED=true" >> "$GITHUB_ENV"
else
echo "DEPLOYFAILED=false" >> "$GITHUB_ENV"
fi
name: Deploy Check env: DEPLOYFAILED: ${{ env.DEPLOYFAILED }} if: env.DEPLOYFAILED == 'true' uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 with: script: | core.setFailed('Deployment did not return a result of SUCCEEDED')
`
+1 to this, especially since this action doesn't seem to support VPCs so there's a need to be able to just kick off an existing service. The solution by @dmmsou is a great workaround in the mean time - kudos!
Currently the action creates or updates the service accordingly. If support is added for a flag that jsut calls a
StartDeployment
for the use-cases where a user may not want to update any configuration and jiust trigger a new version of their code/image.