Skip to content

* fix : change default FittingModelService upload logic more simple a… #36

* fix : change default FittingModelService upload logic more simple a…

* fix : change default FittingModelService upload logic more simple a… #36

Workflow file for this run

name: Deploy to EC2
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Create .env file
run: |
rm -f .env
echo "DB_USERNAME=${{ secrets.DB_USERNAME }}" >> .env
echo "DB_PASSWORD=${{ secrets.DB_PASSWORD }}" >> .env
echo "DB_NAME=${{ secrets.DB_NAME }}" >> .env
echo "AWS_ACCESS_KEY=${{ secrets.AWS_ACCESS_KEY }}" >> .env
echo "AWS_SECRET_KEY=${{ secrets.AWS_SECRET_KEY }}" >> .env
echo "AWS_S3_BUCKET_NAME=${{ secrets.AWS_S3_BUCKET_NAME }}" >> .env
echo "AWS_REGION=${{ secrets.AWS_REGION }}" >> .env
echo "FITTING_SERVER_URI_PROD=${{ secrets.FITTING_SERVER_URI_PROD }}" >> .env
echo "IMAGE_CLASSIFICATION_SERVER_URI_PROD=${{ secrets.IMAGE_CLASSIFICATION_SERVER_URI_PROD }}" >> .env
echo "OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}" >> .env
echo "OPENAI_URL=${{ secrets.OPENAI_URL }}" >> .env
echo "DOMAIN=${{ secrets.DOMAIN }}" >> .env
- name: Copy .env file to EC2
uses: appleboy/[email protected]
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USER }}
key: ${{ secrets.EC2_SSH_KEY }}
source: "./.env"
target: "/app"
- name: Deploy on EC2 with Docker Compose
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USER }}
key: ${{ secrets.EC2_SSH_KEY }}
script: |
cd /app || exit 1
git fetch --all
git reset --hard origin/main
docker-compose down
docker-compose build
docker-compose up -d
- name: Send Success Message to Discord
if: success()
uses: Ilshidur/[email protected]
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_URL }}
DISCORD_USERNAME: 임건 노동 착취 봇
DISCORD_AVATAR: ${{ secrets.LIM_GUN }}
DISCORD_EMBEDS: |
[
{
"title": "🚀 배포가 **성공**했습니다! 🎉",
"color": 3066993,
"description": "프론트엔드는 아직인가요?????????????? 😤 (임건 일해라)"
}
]
- name: Send Failure Message to Discord
if: failure()
uses: Ilshidur/[email protected]
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_URL }}
DISCORD_USERNAME: 임건 노동 착취 봇
DISCORD_AVATAR: ${{ secrets.LIM_GUN }}
DISCORD_EMBEDS: |
[
{
"title": "배포에 실패했습니다.",
"color": 15158332,
"description": "로그를 확인해주세요."
}
]