Skip to content

update workflow

update workflow #8

name: Docker Build with AWS CodeBuild
on:
push:
branches:
- feat/deploy
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Start AWS CodeBuild
id: start_build
run: |
output=$(aws codebuild start-build --project-name guiai)
build_id=$(echo $output | jq -r '.build.id')
echo "::set-output name=build_id::$build_id"
- name: Check AWS CodeBuild status
run: |
build_id="${{ steps.start_build.outputs.build_id }}"
status="IN_PROGRESS"
while [ "$status" == "IN_PROGRESS" ]; do
output=$(aws codebuild batch-get-builds --ids $build_id)
status=$(echo $output | jq -r '.builds[0].buildStatus')
echo "Current build status: $status"
if [ "$status" == "SUCCEEDED" ]; then
echo "Build succeeded."
break
elif [ "$status" == "FAILED" ]; then
echo "Build failed."
exit 1
fi
sleep 30
done