diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test_deploy.yml similarity index 81% rename from .github/workflows/build_test.yml rename to .github/workflows/build_test_deploy.yml index 0c99857..f0c664d 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test_deploy.yml @@ -107,3 +107,21 @@ jobs: tags: | ghcr.io/tbmc/brainfuck_interpreter:latest ghcr.io/tbmc/brainfuck_interpreter:${{ steps.vars.outputs.sha_short }} + + deploy: + name: Deploy to server + runs-on: ubuntu-22.04 + needs: [build_and_publish] + if: github.event_name != 'pull_request' + steps: + - name: Run docker pull and up commands + uses: appleboy/ssh-action@v1.0.3 + with: + host: ${{ secrets.SERVER_HOST }} + username: ${{ secrets.SERVER_USERNAME }} + password: ${{ secrets.SERVER_PASSWORD }} + port: ${{ secrets.SERVER_PORT }} + script: | + cd ${{ secrets.SERVER_FOLDER_PATH }} + docker compose pull ${{ secrets.DOCKER_SERVICE_NAME }} + docker compose up -d ${{ secrets.DOCKER_SERVICE_NAME }}