Skip to content

Commit

Permalink
chore:jq
Browse files Browse the repository at this point in the history
  • Loading branch information
codernesty committed Aug 22, 2024
1 parent e98756c commit 4291758
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Deploy Backend
run: |
SERVICE_ARN=$(aws apprunner list-services --query "ServiceSummaryList[?ServiceName=='${{ secrets.APP_RUNNER_SERVICE_NAME_BACKEND }}'].ServiceArn | [0]" --output text)
if [ -z "$SERVICE_ARN" ]; then
echo "Error: Service ARN not found for service name ${{ secrets.APP_RUNNER_SERVICE_NAME_BACKEND }}."
exit 1
Expand All @@ -40,10 +40,16 @@ jobs:
MAX_RETRIES=15
BACKOFF_TIME=5 # Initial backoff time in seconds
# Construct the JSON source configuration using jq
SOURCE_CONFIG=$(jq -n \
--arg repoUrl "${{ secrets.REPOSITORY_URL }}" \
'{ CodeRepository: { RepositoryUrl: $repoUrl, SourceCodeVersion: { Type: "BRANCH", Value: "master" }, SourceDirectory: "linguaphoto" } }'
)
while [ $RETRY_COUNT -lt $MAX_RETRIES ]; do
if aws apprunner update-service \
--service-arn "$SERVICE_ARN" \
--source-configuration "{\"CodeRepository\":{\"RepositoryUrl\":\"${{ secrets.REPOSITORY_URL }}\",\"SourceCodeVersion\":{\"Type\":\"BRANCH\",\"Value\":\"master\"},\"SourceDirectory\":\"linguaphoto\"}"; then
--source-configuration "$SOURCE_CONFIG"; then
echo "Service updated successfully."
exit 0
else
Expand Down

0 comments on commit 4291758

Please sign in to comment.