parameterize IP #99
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
# The following script assumes the following: | |
# | |
# Depencencies installed on the destination machine: pm2 | |
# * `~/inhouse-bot` is this cloned repo in the user's home directory | |
# * Environment variable DISCORD_TOKEN is set or set in a .env file locally in the repo location | |
# * discory.py and python-dotenv dependencies are installed (e.g., `pip3.8 install discord.py python-dotenv`) | |
# * `pm2 start inhouse-bot.py --interpreter=python3.8 --name inhouse-bot` was previously run | |
name: Deploy inhouse-bot | |
# Controls when the action will run. | |
on: | |
push: | |
branches: [ main ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
deploy: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
- name: deploy script | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.SERVER_NAME }} | |
username: ${{ secrets.DEPLOY_USER }} | |
password: ${{ secrets.DEPLOY_PASSWORD }} | |
script: | | |
export NVM_DIR=~/.nvm | |
source ~/.nvm/nvm.sh | |
cd ~/inhouse-bot | |
git reset --hard main | |
git pull origin main | |
pm2 restart inhouse-bot --update-env | |
pm2 restart inhouse-comms --update-env | |