From 7aa27519751c4b65b25f61d7373da6353bcd6bdd Mon Sep 17 00:00:00 2001 From: Talha Ahmed Date: Mon, 31 Aug 2026 16:22:13 +0500 Subject: [PATCH] Adopt DevOps-supplied deploy-to-s3.yml (appends CodeBuild buildspec section) 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 --- .gitea/workflows/deploy-to-s3.yml | 88 +++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 .gitea/workflows/deploy-to-s3.yml diff --git a/.gitea/workflows/deploy-to-s3.yml b/.gitea/workflows/deploy-to-s3.yml new file mode 100644 index 0000000..2075ddc --- /dev/null +++ b/.gitea/workflows/deploy-to-s3.yml @@ -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 + + +