[bug] 추천 제품 로직 배포 서버 chrome로딩 에러 수정 #52
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Moodico Server | |
on: | |
workflow_dispatch: | |
push: | |
branches: ["main", "main-test"] | |
pull_request: | |
branches: ["main"] | |
concurrency: | |
group: deploy-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: "pip" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Run tests | |
run: | | |
python manage.py test | |
deploy: | |
runs-on: ubuntu-latest | |
needs: test | |
if: (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/main-test')) || github.event_name == 'workflow_dispatch' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Deploy to server | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.HOST }} | |
username: ubuntu | |
key: ${{ secrets.KEY }} | |
script: | | |
set -e | |
BRANCH="${{ github.ref_name }}" | |
echo "Deploying branch: $BRANCH" | |
sudo chown -R ubuntu:ubuntu /home/ubuntu/Moodico | |
sudo git config --system --add safe.directory /home/ubuntu/Moodico | |
cd /home/ubuntu/Moodico | |
git fetch origin "$BRANCH" | |
git reset --hard "origin/$BRANCH" | |
source venv/bin/activate | |
pip install --upgrade pip | |
pip install -r requirements.txt | |
python manage.py migrate --noinput | |
python manage.py collectstatic --noinput | |
sudo systemctl restart gunicorn | |
sudo systemctl reload nginx |