From 8be4073d8cb2b35072ca97f7b70aef64a1a2a734 Mon Sep 17 00:00:00 2001 From: Jason <81298350+Deutscher775@users.noreply.github.com> Date: Wed, 21 Aug 2024 11:03:26 +0200 Subject: [PATCH] Testing automated ga deploy --- .github/workflows/automated_api_deploy.yaml | 42 +++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/automated_api_deploy.yaml diff --git a/.github/workflows/automated_api_deploy.yaml b/.github/workflows/automated_api_deploy.yaml new file mode 100644 index 0000000..94d1cba --- /dev/null +++ b/.github/workflows/automated_api_deploy.yaml @@ -0,0 +1,42 @@ +name: Deploy Astroid API update via Github Actions +on: + push: + branches: + - main + +jobs: + pull_changes: + 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 + + - 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 + deploy: + runs-on: ubuntu-latest + steps: + - name: Deploy the 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 \ No newline at end of file