v2.12.16.2024-21-stable #33
Workflow file for this run
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 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 |