a fix README.md #12
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: Deploy DuplicateMessageBot | |
| # Запуск на пуш в main или вручную по кнопке из Github Actions | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Получаем код репозитория | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| # Настраиваем SSH | |
| - name: Setup SSH | |
| run: | | |
| mkdir -p ~/.ssh | |
| echo "${{ secrets.DEPLOY_KEY }}" > ~/.ssh/id_ed25519 | |
| chmod 600 ~/.ssh/id_ed25519 | |
| # Добавляем сервер в known_hosts, чтобы не спрашивало подтверждение | |
| ssh-keyscan -H ${{ secrets.SERVER_IP }} >> ~/.ssh/known_hosts | |
| # Запускаем деплой на сервере | |
| - name: Deploy to server | |
| run: | | |
| ssh -i ~/.ssh/id_ed25519 ${{ secrets.USERNAME }}@${{ secrets.SERVER_IP }} ' | |
| set -e | |
| mkdir -p ~/DuplicateMessageBot | |
| cd ~/DuplicateMessageBot | |
| if [ ! -d ".git" ]; then | |
| echo "Клонируем репозиторий" | |
| git clone https://github.com/DmitrMarch/DuplicateMessageBot.git . | |
| else | |
| echo "Обновляем репозиторий" | |
| git pull | |
| fi | |
| bash deploy.sh | |
| ' |