From 4a71c6b8d81509d15f3d9d0c2b826aabf2ae2779 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Mon, 13 Sep 2021 16:10:10 +0700 Subject: [PATCH] new deployment method added steps for deployment on GitHub workflows --- README.md | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 75 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f8639fe..be60d09 100644 --- a/README.md +++ b/README.md @@ -39,14 +39,87 @@ telegram bot project for streaming video on telegram video chat, powered by [tgc TAP THIS: [![GenerateString](https://img.shields.io/badge/repl.it-generateString-yellowgreen)](https://replit.com/@levinalab/StringSession#main.py) -## Heroku Deployment 💜 +## 💜 Deploy To Heroku The easy way to host this bot, deploy to Heroku [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/levina-lab/video-stream) -# Railway Deployment 🚄 +## 🚄 Deploy To Railway [![Deploy+on+Railway](https://railway.app/button.svg)](https://railway.app/new/template?template=https://github.com/levina-lab/video-stream&envs=API_ID,API_HASH,BOT_TOKEN,BOT_USERNAME,ASSISTANT_NAME,SESSION_NAME,SUDO_USERS,DURATION_LIMIT) +## 🌀 Run On Workflows + +- fork this repository +- Go to your forked repository settings +- Scroll down and select the `secrets` tab +- Click on `New repository secret` button +- Add the environmental vars as mentioned here +- Then create new file with structure `.github/workflows/run.yml` +- Now in `run.yml` file, fill with this code below, just copy it and paste in `run.yml` file + +```sh +name: Run on workflows +on: + schedule: + - cron: "0 */6 * * *" + push: + branches: [ main ] + workflow_dispatch: + +env: + API_ID: "${{ secrets.API_ID }}" + API_HASH: "${{ secrets.API_HASH }}" + SESSION_NAME: "${{ secrets.SESSION_NAME }}" + BOT_USERNAME: "${{ secrets.BOT_USERNAME }}" + ASSISTANT_NAME: "${{ secrets.ASSISTANT_NAME }}" + DURATION_LIMIT: "${{ secrets.DURATION_LIMIT }}" + BOT_TOKEN: "${{ secrets.BOT_TOKEN }}" + SUDO_USERS: "${{ secrets.SUDO_USERS }}" + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + with: + ref: beta + - uses: styfle/cancel-workflow-action@0.9.0 + name: "Cancelling duplicate workflow runs" + with: + all_but_latest: true + access_token: ${{ github.token }} + - uses: actions/setup-node@v2 + with: + node-version: '16' + - name: Set up Python 3.9 + uses: actions/setup-python@v2.2.2 + with: + python-version: 3.9 + - name: cloning repo and install + + continue-on-error: true + run: | + sudo apt -qq update && sudo apt -qq install -y --no-install-recommends ffmpeg neofetch + pip3 install -r requirements.txt + # echo "API_ID=${{ secrets.API_ID }} | tee .env + # echo "API_HASH=${{ secrets.API_HASH }} | tee -a .env + # echo "BOT_USERNAME=${{ secrets.BOT_USERNAME }} | tee -a .env + # echo "ASSISTANT_NAME=${{ secrets.ASSISTANT_NAME }} | tee -a .env + # echo "SESSION_NAME=${{ secrets.SESSION_NAME }} | tee -a .env + # echo "DURATION_LIMIT=${{ secrets.DURATION_LIMIT }} | tee -a .env + # echo "SUDO_USERS=${{ secrets.SUDO_USERS }} | tee -a .env + # echo "BOT_TOKEN=${{ secrets.BOT_TOKEN }} | tee -a .env || echo "Proceeding with bot" + # cat .env + - name: Running + timeout-minutes: 350 + continue-on-error: true + run: | + python3 -m bot + echo "Bot Died" +``` +- After adding all, Go to the Actions tab and start/run the workflows + ## VPS Deployment ```sh - sudo apt update && upgrade -y