Pre-requisites (Not to be followed while using Service Account, skip to Deployment)
-
Generate the credentials.json using below steps
-
Set up OAuth:
- Visit the Google Cloud Console
- Go to the OAuth Consent tab, fill it, and save.
- Go to the Credentials tab and click Create Credentials -> OAuth Client ID
- Choose Application Type as Desktop app and Create.
- Use the download button to download your credentials.
- Move that file to the root of aria-telegram-mirror-bot, and rename it to
client_secret.json
-
Enable the Drive API:
- Visit the Google API Library page.
- Search for Drive.
- Make sure that it's enabled. Enable it if not.
-
Install nodejs
-
Clone the repo:
git clone https://github.com/arghyac35/aria-telegram-mirror-bot cd aria-telegram-mirror-bot
-
Run
npm install
-
Run
npm run generateDriveCredentials
only if 6th step is successfull
-
Fork this repo
-
Create github secret for each variables below. Click here for how to create github secrets.
-
Add the below variables one by one by clicking New repository secret everytime.
CLIENT_SECRET CREDENTIALS CONSTANTS_URL MAX_CONCURRENT_DOWNLOADS GIT_TOKEN GIT_USER GIT_REPO HEROKU_API_KEY HEROKU_APP_NAME HEROKU_EMAIL
-
CLIENT_SECRET
is URL for client_secret.json, see below for creating URLs # Not required when using SA -
CREDENTIALS
is URL for credentials.json, see below for creating URLs # Not required when using SA -
CONSTANTS_URL
is URL for .constants.js, see below for creating URLs, not sure about .constants.js? then read the description for it in actual Readme # Required -
MAX_CONCURRENT_DOWNLOADS
maximum number of download jobs that will be active at a time #Optional, default is 3 -
HEROKU_API_KEY
Go to your Heroku account and go to Account Settings. Scroll to the bottom until you see API Key. Copy this key and add it # Required -
HEROKU_APP_NAME
Heroku appname # Required, no need to create app manually -
HEROKU_EMAIL
Heroku Account email Id in which the above app will be deployed # Required-
Create a github private repo withy any name and upload all the service accounts as shown in below screenshot:
-
GIT_TOKEN:
Create a Personal Access Token with repo scope. Go to github profile settings->Developer Settings->Personal Access Tokens->Generate new token->Add any note and then select only repo scope & click on Generate token and copy the token->add in this secrect. -
GIT_USER:
Your github username -
GIT_REPO:
Repo name in which the SAs are.
-
-
-
After adding all the above required variables go to github Actions tab in your repo
-
Select
Manually Deploy to heroku
workflow as shown below: -
Then click on Run workflow
-
Voila! your bot will be deployed now.
-
For updating the bot just run the action again, it will handle the rest. Also, while updating do keep a look at the .constants.js if anything new got added then you need to add that too in your link.
How to create URLs using github gists
- All the URLs should be direct and publicly accessible, Example of a CONSTANTS_URL https://gist.githubusercontent.com/arghyac35/04c2e78a89f00b21303dd45274b2c4c4/raw/4182c22062b80072b82ab0c290ed40784752dd48/.constants.js.
- Open https://gist.github.com
- Add the values for said secret as below:
- Now, copy the raw URL for each gist:
-
Go to Project->Settings->Secrets and Click New repository secret. Click here to see the final view after adding al secrets.
-
Add secrets like below: