Skip to content

Commit cc3038f

Browse files
committed
fix ci/cd
1 parent 5866fb5 commit cc3038f

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

.github/workflows/github-actions.yml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,33 @@ jobs:
7373
SERVER_USER: ${{ secrets.SERVER_USER }}
7474
run: |
7575
ssh $SERVER_USER@$SERVER_IP << 'EOF'
76+
# Установка зависимостей (если их нет)
77+
if ! command -v docker &> /dev/null; then
78+
sudo apt-get update
79+
sudo apt-get install -y docker.io
80+
sudo systemctl enable docker
81+
sudo systemctl start docker
82+
fi
83+
84+
if ! command -v docker-compose &> /dev/null; then
85+
sudo curl -L "https://github.com/docker/compose/releases/download/v2.23.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
86+
sudo chmod +x /usr/local/bin/docker-compose
87+
fi
88+
89+
# Работа с репозиторием
7690
if [ -d "Automating-route-selection" ]; then
7791
cd Automating-route-selection
7892
git pull origin main
7993
else
8094
git clone https://github.com/Dema-koder/Automating-route-selection.git
8195
cd Automating-route-selection
8296
fi
83-
84-
# Создаем .env файл с секретами
97+
98+
# Создание .env
8599
echo "BOT_TOKEN=$BOT_TOKEN" > .env
86100
echo "GPT_TOKEN=$GPT_TOKEN" >> .env
87-
88-
# Запускаем приложение
89-
docker-compose down
90-
docker-compose up -d --build
101+
102+
# Запуск приложения
103+
sudo docker-compose down || true
104+
sudo docker-compose up -d --build
91105
EOF

0 commit comments

Comments
 (0)