Skip to content

Commit

Permalink
chore: 환경변수 주입 방식 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
seokheePark committed Dec 9, 2024
1 parent d9ae682 commit f22d347
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/gradle-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,23 @@ jobs:
DB_HOST: ${{ secrets.DB_HOST }}
DB_USERNAME: ${{ secrets.DB_USERNAME }}
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}

- name: Deploy to EC2
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.EC2_HOST }}
username: ubuntu
key: ${{ secrets.EC2_SSH_KEY }}
envs: DB_HOST,DB_USERNAME,DB_PASSWORD
environment: |
DB_HOST=${{ secrets.DB_HOST }}
DB_USERNAME=${{ secrets.DB_USERNAME }}
DB_PASSWORD=${{ secrets.DB_PASSWORD }}
script: |
echo "DB_HOST=${{ secrets.DB_HOST }}" | sudo tee -a /etc/environment
echo "DB_USERNAME=${{ secrets.DB_USERNAME }}" | sudo tee -a /etc/environment
echo "DB_PASSWORD=${{ secrets.DB_PASSWORD }}" | sudo tee -a /etc/environment
source /etc/environment
echo "DB_HOST=${{ secrets.DB_HOST }}" >> ~/.profile
echo "DB_USERNAME=${{ secrets.DB_USERNAME }}" >> ~/.profile
echo "DB_PASSWORD=${{ secrets.DB_PASSWORD }}" >> ~/.profile
source ~/.profile
sudo systemctl restart spring-app
- name: Copy JAR
Expand Down

0 comments on commit f22d347

Please sign in to comment.