Skip to content

Commit 1605017

Browse files
committed
chore: update GitHub Actions workflow for secure deployment
- Add steps to securely handle SSH private key - Ensure environment variables are securely created in .env file - Set proper permissions for .env file - Use GitHub Secrets for sensitive information
1 parent 5476f7c commit 1605017

File tree

2 files changed

+5
-59
lines changed

2 files changed

+5
-59
lines changed

.github/workflows/cd.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ jobs:
2525
2626
- name: Deploy to EC2
2727
env:
28-
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
28+
PAT: ${{ secrets.PAT }}
2929
SERVER_IP: ${{ secrets.SERVER_IP }}
3030
USERNAME: ${{ secrets.USERNAME }}
31-
GITHUB_SECRET: ${{ secrets.MY_GITHUB_SECRET }}
31+
MY_GITHUB_SECRET: ${{ secrets.MY_GITHUB_SECRET }}
3232
CHANNEL_ID: ${{ secrets.CHANNEL_ID }}
3333
run: |
3434
echo "$SSH_PRIVATE_KEY" > private_key
@@ -46,9 +46,9 @@ jobs:
4646
# Deploy using Docker Compose
4747
ssh -i private_key -o StrictHostKeyChecking=no $USERNAME@$SERVER_IP '
4848
cd /home/$USERNAME/telex-commit-integration && \
49-
echo "GITHUB_SECRET=${MY_GITHUB_SECRET}" > .env && \
49+
echo "MY_GITHUB_SECRET=${MY_GITHUB_SECRET}" > .env && \
5050
echo "CHANNEL_ID=${CHANNEL_ID}" >> .env && \
51+
chmod 600 .env && \
5152
sudo docker-compose down && \
5253
sudo docker-compose up --build -d && \
53-
sudo docker system prune -f
54-
'
54+
sudo docker system prune -f

cd.yml

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)