Skip to content

Merge pull request #63 from dome9/DFT-3126-fix #13

Merge pull request #63 from dome9/DFT-3126-fix

Merge pull request #63 from dome9/DFT-3126-fix #13

name: gcp update zip on commit
on:
push:
branches: [ "master"]
workflow_dispatch:
jobs:
deploy:
name: upload to Amazon s3
runs-on: ubuntu-latest
env:
ACTIONS_STEP_DEBUG: true
permissions:
id-token: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get AWS permissions
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{secrets.ASSUMEROLE}}
aws-region: us-east-1
- name: Copy and zip repo files to s3
run: |
set -x # Enable debug mode
pwd=`pwd`
uploadFolder="upload"
echo "Current working directory: $pwd"
mkdir $uploadFolder
echo "Created $uploadFolder directory."
mkdir $uploadFolder/.python_packages
echo "Created $uploadFolder/.python_packages directory."
mkdir $uploadFolder/.python_packages/lib
echo "Created $uploadFolder/.python_packages/lib directory."
mkdir $uploadFolder/.python_packages/lib/site-packages
echo "Created $uploadFolder/.python_packages/lib/site-packages directory."
cp handle_event.py $uploadFolder
echo "Copied handle_event.py to $uploadFolder."
cp send_events_and_errors.py $uploadFolder
echo "Copied send_events_and_errors.py to $uploadFolder."
cp send_logs.py $uploadFolder
echo "Copied send_logs.py to $uploadFolder."
cp send_logs_api_gateway.py $uploadFolder
echo "Copied send_logs_api_gateway.py to $uploadFolder."
cp requirements.txt $uploadFolder
echo "Copied requirements.txt to $uploadFolder."
cp main.py $uploadFolder
echo "Copied main.py to $uploadFolder."
cp -rf bots $uploadFolder
echo "Copied bots folder to $uploadFolder."
pip install -r requirements.txt --target=$uploadFolder/.python_packages/lib/site-packages
echo "Installed Python packages to $uploadFolder/.python_packages/lib/site-packages."
cd $uploadFolder
zip -r9 $pwd/cloud-bots-gcp.zip .
echo "Created zip archive: $pwd/cloud-bots-gcp.zip"
cd $pwd
aws s3 cp $pwd/cloud-bots-gcp.zip "s3://dome9-backend-artifacts/gcpcloudbots/cloud-bots-gcp.zip" --acl public-read
echo "Uploaded cloud-bots-gcp.zip to S3."