Skip to content

Commit

Permalink
feat: add github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
RaoHai committed Sep 13, 2024
1 parent 2cf3a8b commit b3db3c9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/aws-amplify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,21 @@ jobs:

- name: Deploy to Amplify
run: |
aws amplify create-branch --stage PULL_REQUEST --app-id ${{ env.AMPLIFY_APP_ID }} --branch-name ${{ github.ref_name }} || true
echo "Checking for pending job on branch ${{ github.ref_name }}"
aws amplify create-branch --stage PULL_REQUEST --app-id ${{ env.AMPLIFY_APP_ID }} --branch-name ${{ github.head_ref }} || true
echo "Checking for pending job on branch ${{ github.head_ref }}"
while true; do
jobs=$(
aws amplify list-jobs \
--app-id ${{ env.AMPLIFY_APP_ID }} \
--branch-name "${{ github.ref_name }}" \
--branch-name "${{ github.head_ref }}" \
--output "json" --no-paginate
)
pending_jobs=$(echo $jobs | jq '.jobSummaries | map(select(.status | IN("FAILED", "SUCCEED", "CANCELLED") | not))')
pending_job_count=$(echo $pending_jobs | jq 'length')
echo "Pending Jobs: $pending_job_count"
if [ "$pending_job_count" -gt 0 ]; then
echo "$pending_job_count Pending Job(s) found on branch ${{ github.ref_name }}. Waiting..."
echo "$pending_job_count Pending Job(s) found on branch ${{ github.head_ref }}. Waiting..."
sleep 10
else
echo "All Pending Jobs done... Proceeding"
Expand All @@ -89,5 +89,5 @@ jobs:
echo "Starting Amplify Job"
aws amplify start-job \
--app-id ${{ env.AMPLIFY_APP_ID }} \
--branch-name ${{ github.ref_name }} \
--branch-name ${{ github.head_ref }} \
--job-type RELEASE

0 comments on commit b3db3c9

Please sign in to comment.