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