build(all): del 'CHAT_ID_3' & 'CHAT_ID_4' #11
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 to VPS | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
workflow_dispatch: | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install SSH Key | |
uses: shimataro/ssh-key-action@v2 | |
with: | |
key: ${{ secrets.CAPTCHA_BOT_SSH_PRIVATE_KEY }} | |
known_hosts: unnecessary | |
- name: Adding Known Hosts | |
run: ssh-keyscan -H ${{ secrets.CAPTCHA_BOT_SSH_HOST }} >> ~/.ssh/known_hosts | |
- name: Run command on remote server | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.CAPTCHA_BOT_SSH_HOST }} | |
username: ${{ secrets.CAPTCHA_BOT_SSH_USER }} | |
key: ${{ secrets.CAPTCHA_BOT_SSH_PRIVATE_KEY }} | |
script: | | |
echo '--- START WORK ON REMOTE SERVER ---'; | |
cd CaptchaBot; | |
echo '--- EXPORT VARIABLES ---'; | |
export BOT_TOKEN=${{ secrets.CAPTCHA_BOT_TOKEN }}; | |
export CHAT_ID_1=${{ vars.CHAT_ID_1 }} | |
export CHAT_ID_2=${{ vars.CHAT_ID_2 }} | |
echo '--- LIST OF FILES ---'; | |
ls -al; | |
echo '--- GIT PULL ---' | |
git pull; | |
echo '--- DOCKER OPERATIONS ---'; | |
docker-compose down; | |
docker rmi captcha_bot; | |
echo '--- LIST OF DOCKER CONTAINERS ---'; | |
docker ps -a; | |
echo '--- UP CONTAINER ---'; | |
docker-compose up -d; | |
echo '--- LIST OF DOCKER CONTAINERS ---'; | |
docker ps -a; |