Skip to content

Commit 3d7ca1c

Browse files
Update main.yml
1 parent c5a499b commit 3d7ca1c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

.github/workflows/main.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ jobs:
2727
run: |
2828
ssh -o StrictHostKeyChecking=no ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }} "echo SSH Connection Successful"
2929
30+
- name: Create .env File
31+
uses: 'DamianReeves/write-file-action@master'
32+
with:
33+
path: ~/website-cms/.env
34+
write-mode: overwrite
35+
contents: ${{ secrets.ENV_FILE_CONTENT }}
36+
3037
- name: Deploy to EC2
3138
run: |
3239
ssh -o StrictHostKeyChecking=no ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }} << 'EOF'
@@ -38,8 +45,6 @@ jobs:
3845
sudo chmod -R u+rwX ~/website-cms
3946
git config --global --add safe.directory "$(pwd)"
4047
git pull origin main
41-
cat > .env <<EOT
42-
${{ secrets.ENV_FILE_CONTENT }}
43-
EOT
48+
4449
docker compose up -d --build
4550
EOF

0 commit comments

Comments
 (0)