Skip to content

Commit

Permalink
fix: Add environment variables to Sepolia deployment
Browse files Browse the repository at this point in the history
- Add env section to pass GitHub secrets to SSH action
- Create .env file on remote server during deployment
- Pass required environment variables for PostgreSQL and services
- Include all necessary Sepolia-specific variables
  • Loading branch information
ametel01 committed Dec 3, 2024
1 parent b2ecc0d commit 94ea548
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions .github/workflows/deploy.sepolia.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Deploy to Sepolia Test Environment
on:
push:
branches:
- sepolia-db # or sepolia-test, develop, staging, etc.
- sepolia-db

jobs:
deploy:
Expand All @@ -12,20 +12,38 @@ jobs:
steps:
- name: SSH into Remote Server and Deploy Changes
uses: appleboy/[email protected]
env:
SEPOLIA_DB_STRING: ${{ secrets.SEPOLIA_DB_STRING }}
SEPOLIA_NODE_STRING: ${{ secrets.SEPOLIA_NODE_STRING }}
SEPOLIA_ROUTER_ENDPOINT: ${{ secrets.SEPOLIA_ROUTER_ENDPOINT }}
SEPOLIA_POSTGRES_USER: ${{ secrets.SEPOLIA_POSTGRES_USER }}
SEPOLIA_POSTGRES_PASSWORD: ${{ secrets.SEPOLIA_POSTGRES_PASSWORD }}
SEPOLIA_POSTGRES_DB: ${{ secrets.SEPOLIA_POSTGRES_DB }}
with:
host: ec2-3-87-142-202.compute-1.amazonaws.com
username: ubuntu
key: ${{ secrets.SSH_PRIVATE_KEY }}
passphrase: ${{ secrets.SSH_PASSPHRASE }}
port: 22
envs: SEPOLIA_DB_STRING,SEPOLIA_NODE_STRING,SEPOLIA_ROUTER_ENDPOINT,SEPOLIA_POSTGRES_USER,SEPOLIA_POSTGRES_PASSWORD,SEPOLIA_POSTGRES_DB
script: |
# Navigate to the project directory
cd ~/fossil-headers-db
# Pull the latest changes from the sepolia-db branch
# Pull the latest changes from the sepolia branch
git fetch origin sepolia-db
git reset --hard origin/sepolia-db
# Create or update .env file with the environment variables
cat > .env << EOL
SEPOLIA_DB_STRING=${SEPOLIA_DB_STRING}
SEPOLIA_NODE_STRING=${SEPOLIA_NODE_STRING}
SEPOLIA_ROUTER_ENDPOINT=${SEPOLIA_ROUTER_ENDPOINT}
SEPOLIA_POSTGRES_USER=${SEPOLIA_POSTGRES_USER}
SEPOLIA_POSTGRES_PASSWORD=${SEPOLIA_POSTGRES_PASSWORD}
SEPOLIA_POSTGRES_DB=${SEPOLIA_POSTGRES_DB}
EOL
# Ensure Docker and Docker Compose are installed
docker --version || { echo "Docker not found"; exit 1; }
docker-compose --version || { echo "Docker Compose not found"; exit 1; }
Expand Down

0 comments on commit 94ea548

Please sign in to comment.