feat:AddedActions #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy to AWS App Runner | ||
| on: | ||
| push: | ||
| branches: [main] | ||
| env: | ||
| AWS_REGION: ${{ secrets.AWS_REGION }} | ||
| ECR_REPO: ${{ secrets.ECR_REPO }} | ||
| IMAGE_TAG: latest | ||
| jobs: | ||
| build-and-deploy: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout Code | ||
| uses: actions/checkout@v4 | ||
| - name: Configure AWS Credentials | ||
| uses: aws-actions/configure-aws-credentials@v4 | ||
| with: | ||
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
| aws-region: ${{ env.AWS_REGION }} | ||
| - name: Log in to Amazon ECR | ||
| id: login-ecr | ||
| uses: aws-actions/amazon-ecr-login@v2 | ||
| - name: Build and Push Docker Image | ||
| id: docker | ||
| run: | | ||
| IMAGE_URI="${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPO }}:${{ env.IMAGE_TAG }}" | ||
| echo "IMAGE_URI=$IMAGE_URI" >> $GITHUB_OUTPUT | ||
| docker build -t $IMAGE_URI . | ||
| docker push $IMAGE_URI | ||
| - name: Output Image URI | ||
| run: echo "β Image successfully pushed: ${{ steps.docker.outputs.IMAGE_URI }}" | ||