Skip to content

Commit

Permalink
syntax fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cankurttekin committed Nov 19, 2024
1 parent 72d6446 commit 8e9dc74
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,19 @@ jobs:
# Set up SSH Key for EC2 Access
- name: Set Up SSH
env:
EC2_SSH_KEY: ${{ secrets.EC2_SSH_KEY }}
PRIVATE_KEY: ${{ secrets.EC2_SSH_KEY }}
EC2_USER: ${{ secrets.EC2_USER }}
EC2_HOST: ${{ secrets.EC2_HOST }}
run: |
mkdir -p ~/.ssh
echo "$EC2_SSH_KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
echo "$PRIVATE_KEY" > github-ec2 && chmod 600 github-ec2
# Copy backend files to EC2
- name: Deploy Application to EC2
env:
EC2_USER: ${{ secrets.EC2_USER }}
EC2_HOST: ${{ secrets.EC2_HOST }}
run: |
echo "Copying backend directory to EC2..."
ssh -v -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa $EC2_USER@$EC2_HOST "echo Connected"
scp -o StrictHostKeyChecking=no -r backend/docker-compose.yml $EC2_USER@$EC2_HOST:~/job-application-tracker/
ssh -v -o StrictHostKeyChecking=no -i github-ec2 ${EC2_USER}@${EC2_HOST} "echo Connected"
scp -o StrictHostKeyChecking=no -r backend/docker-compose.yml ${EC2_USER}@${EC2_HOST}:~/job-application-tracker/
# Create .env file on EC2
- name: Configure Environment Variables
Expand All @@ -51,7 +49,7 @@ jobs:
TURNSTILE_SECRET: ${{ secrets.TURNSTILE_SECRET }}
run: |
echo "Creating .env file on EC2..."
ssh -o StrictHostKeyChecking=no $EC2_USER@$EC2_HOST << 'EOF'
ssh -o StrictHostKeyChecking=no ${EC2_USER}@${EC2_HOST} << 'EOF'
mkdir -p ~/job-application-tracker
cat <<EOT > ~/job-application-tracker/.env
APP_URL=${APP_URL}
Expand Down Expand Up @@ -82,7 +80,7 @@ jobs:
EC2_HOST: ${{ secrets.EC2_HOST }}
run: |
echo "Deploying application on EC2..."
ssh -o StrictHostKeyChecking=no $EC2_USER@$EC2_HOST << 'EOF'
ssh -o StrictHostKeyChecking=no ${EC2_USER}@${EC2_HOST} << 'EOF'
cd ~/job-application-tracker
docker-compose down
docker-compose up --build -d
Expand Down

0 comments on commit 8e9dc74

Please sign in to comment.