Skip to content

v2.12.16.2024-21-stable #33

v2.12.16.2024-21-stable

v2.12.16.2024-21-stable #33

name: Deploy Astroid API update via Github Actions
on:
workflow_dispatch:
release:
types: [published]
jobs:
stop_api:
runs-on: ubuntu-latest
steps:
- name: API Shutdown
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
password: ${{ secrets.SSH_PASSWORD }}
port: ${{ secrets.SSH_PORT }}
script: |
sudo systemctl stop astroidapi
backup_api:
runs-on: ubuntu-latest
needs: stop_api
steps:
- name: Backup API image
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
password: ${{ secrets.SSH_PASSWORD }}
port: ${{ secrets.SSH_PORT }}
script: |
cp -r /root/guildcord/src/astroidapi /root/backup/guildcord/src
cp -r /root/guildcord/src/api.py /root/backup/guildcord/src
update_api:
runs-on: ubuntu-latest
needs: [stop_api, backup_api]
steps:
- name: Pull changes
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
password: ${{ secrets.SSH_PASSWORD }}
port: ${{ secrets.SSH_PORT }}
script: |
cd /root/astroid
git pull origin main
cp -r /root/astroid/src/astroidapi /root/guildcord/src
cp -r /root/astroid/src/api.py /root/guildcord/src
deploy_api:
runs-on: ubuntu-latest
needs: [stop_api, update_api, backup_api]
steps:
- name: Deploy API
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
password: ${{ secrets.SSH_PASSWORD }}
port: ${{ secrets.SSH_PORT }}
script: |
sudo systemctl start astroidapi