Deploy Discord-Bot #2533
This file contains 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 Discord-Bot | |
on: | |
schedule: | |
# Запускать каждые 10 минут | |
- cron: '*/10 * * * *' | |
workflow_dispatch: | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.11' | |
- name: Install MariaDB Connector/C | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libmariadb-dev | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Load Environment Variables | |
run: | | |
echo "DISCORD_KEY=${{ secrets.DISCORD_KEY }}" >> $GITHUB_ENV | |
echo "GITHUB=${{ secrets.GITHUB }}" >> $GITHUB_ENV | |
echo "USER=${{ secrets.USER }}" >> $GITHUB_ENV | |
echo "PASSWORD=${{ secrets.PASSWORD }}" >> $GITHUB_ENV | |
echo "HOST=${{ secrets.HOST }}" >> $GITHUB_ENV | |
echo "PORT=${{ secrets.PORT }}" >> $GITHUB_ENV | |
echo "DATABASE=${{ secrets.DATABASE }}" >> $GITHUB_ENV | |
echo "POST_AUTHORIZATION_DEV=${{ secrets.POST_AUTHORIZATION_DEV }}" >> $GITHUB_ENV | |
echo "POST_AUTHORIZATION_MRP=${{ secrets.POST_AUTHORIZATION_MRP }}" >> $GITHUB_ENV | |
echo "POST_USER_AGENT=${{ secrets.POST_USER_AGENT }}" >> $GITHUB_ENV | |
echo "POST_USERNAME_DEV=${{ secrets.POST_USERNAME_DEV }}" >> $GITHUB_ENV | |
echo "POST_PASSWORD_DEV=${{ secrets.POST_PASSWORD_DEV }}" >> $GITHUB_ENV | |
echo "POST_USERNAME_MRP=${{ secrets.POST_USERNAME_MRP }}" >> $GITHUB_ENV | |
echo "POST_PASSWORD_MRP=${{ secrets.POST_PASSWORD_MRP }}" >> $GITHUB_ENV | |
echo "DB_HOST=${{ secrets.DB_HOST }}" >> $GITHUB_ENV | |
echo "DB_DATABASE=${{ secrets.DB_DATABASE }}" >> $GITHUB_ENV | |
echo "DB_USER=${{ secrets.DB_USER }}" >> $GITHUB_ENV | |
echo "DB_PASSWORD=${{ secrets.DB_PASSWORD }}" >> $GITHUB_ENV | |
echo "DB_PORT=${{ secrets.DB_PORT }}" >> $GITHUB_ENV | |
echo "POST_ADMIN_API=${{ secrets.POST_ADMIN_API }}" >> $GITHUB_ENV | |
echo "POST_ADMIN_NAME=${{ secrets.POST_ADMIN_NAME }}" >> $GITHUB_ENV | |
echo "POST_ADMIN_GUID=${{ secrets.POST_ADMIN_GUID }}" >> $GITHUB_ENV | |
- name: Run bot | |
env: | |
DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }} | |
run: | | |
echo "Starting the bot..." | |
python main.py |