Skip to content

Update deploy-on-master-push.yml #14

Update deploy-on-master-push.yml

Update deploy-on-master-push.yml #14

name: Deploy on Master Push v5
on:
push:
branches:
- master
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setting up SSH key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.AWS_KEY }}" > ~/.ssh/id_aws.pem
chmod 600 ~/.ssh/id_aws.pem
ssh-keyscan -H ec2-34-224-89-239.compute-1.amazonaws.com >> ~/.ssh/known_hosts
- name: Connect to EC2 and run script
run: |
ssh -i "~/.ssh/id_aws.pem" [email protected] '
ls;
psql --host=geodb.cfhjsivstphy.us-east-1.rds.amazonaws.com --port=5432 --username=postgres --dbname=geodb;
# echo "Another command";
# Add more commands as needed
TABLE_PREFIX=khm # This is your dynamic part that you want to inject
# Use sed to replace a placeholder in the SQL file with the desired table prefix
sed "s/:table_prefix/$TABLE_PREFIX/" create_table_template.sql > create_table.sql
# Now run the modified SQL script
psql --host=geodb.cfhjsivstphy.us-east-1.rds.amazonaws.com --port=5432 --username=postgres --dbname=geodb -f create_table.sql
'