Adopt DevOps-supplied deploy-to-s3.yml (appends CodeBuild buildspec section)
Deploy to S3 / deploy (push) Successful in 24s Details

Provided by Yaseen (DevOps) to enable the Gitea Actions pipeline; the
ci.yml.bkp from the same bundle was dropped at his instruction.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
main
Talha Ahmed 2026-08-31 16:22:13 +05:00
parent 30f75c2f78
commit 7aa2751975
1 changed files with 88 additions and 0 deletions

View File

@ -0,0 +1,88 @@
name: Deploy to S3
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Configure AWS credentials
env:
AWS_ACCESS_KEY_ID: ${{ secrets.DEVOPS_USER_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.DEVOPS_USER_AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-east-1
run: |
echo "AWS credentials configured"
- name: Archive project
run: |
apt-get update -y
apt-get install -y zip
zip -r utopia-ai-finance-accounts.zip . \
-x ".git/*" \
-x ".gitea/*" \
-x ".gitignore/*" \
-x "*.DS_Store"
- name: Install AWS CLI
run: |
apt-get update -y
apt-get install -y curl unzip
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip -q awscliv2.zip
./aws/install
aws --version
- name: Upload files to S3
env:
AWS_ACCESS_KEY_ID: ${{ secrets.DEVOPS_USER_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.DEVOPS_USER_AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-east-1
run: |
echo "Uploading repo contents to S3..."
aws s3 cp utopia-ai-finance-accounts.zip s3://utopia-ai-s3-repo-bucket/utopia-ai-finance-accounts.zip
version: 0.2
phases:
install:
runtime-versions:
python: 3.11 # better than java for Python project; change version if needed
commands:
- echo "Downloading previous bundle if needed..."
- aws s3 cp s3://utopia-ai-s3-repo-bucket/utopia-ai-finance-accounts.zip .
build:
commands:
- echo "Extracting app.zip to current directory (flat)..."
- unzip -o utopia-ai-finance-accounts.zip || echo "No app.zip found or unzip failed - assuming files already present"
- echo "Downloading deployment files..."
- aws s3 cp s3://utopia-ai-s3-bucket/utopia-ai-finance-accounts-artifact-folder/appspec.yml .
- aws s3 cp s3://utopia-ai-s3-bucket/utopia-ai-finance-accounts-artifact-folder/deploy_utopia-ai-finance-accounts.sh .
- chmod +x *.sh
- ls -la # debug: verify appspec.yml, deploy_ai.sh and Python files are now at root
post_build:
commands:
- echo "Creating deployment bundle..."
- zip -r utopia-ai-finance-accounts.zip . -x "*.zip"
- echo "Uploading final deployment bundle to S3..."
- aws s3 cp utopia-ai-finance-accounts.zip s3://utopia-ai-s3-bucket/utopia-ai-finance-accounts-artifact-folder/utopia-ai-finance-accounts.zip
- aws s3 cp utopia-ai-finance-accounts.zip s3://utopia-ai-fba-pipeline-east2/utopia-ai-finance-accounts.zip --region us-east-2
artifacts:
files:
- '**/*' # everything at root goes into artifact ZIP
discard-paths: no