Skip to main content
Version: 2.0.0

CI/CD

TSCord bundles itself with a complete setup for Github Actions!

Github Actions lets you automate your workflow for building, testing and deploying your application.

More concretely, the provided config will permit you to deploy your bot to a SSH accessible remote machine (like a VPS) on precise events, like the creation of a tag on Github, a push to the main branch, on demand, etc...

Configuration

Secrets

First, you need to setup some secrets in the settings of your github repo (Settings > Secrets > Actions).

From there, add the following secrets (don't worry, after you've set a secret nobody will be able to read it):

NameDescription
IPThe IP of the machine that will host your bot
PORTPut 22 (SSH port)
USERName of the host user to connect as
PASSWORDPassword of the host user to connect as
PROJECT_PATHThe absolute path to your project on the host

Workflow config file

Then, you can customize the behavior in the .github/workflows/deploy.yml config file.

tip

To know how to use Github Actions config files, check the doc here.

By default, the deploy workflow is only triggerable on-demand (Actions > Deploy (SSH) > Run workflow).
We recommand you to either add a trigger on release tag creation or on pushes on your main branch, depending on your global git workflow.

Also, by default, the deploy action will use Docker, but you can easily replace it with PM2:

.github/workflows/deploy.yml
        script: |
cd $PROJECT_PATH
git pull https://github.com/barthofu/tscord-template.git main
docker-compose up -d --build
pm2 restart pm2.config.json
info

Each line under the script property is a command that'll be run on your host machine. You can customize it as you want!