From 7dfe64a535f0a579ec6b0f895e2ea5ff63359fb9 Mon Sep 17 00:00:00 2001 From: Aziz Chynaliev Date: Mon, 3 Jun 2024 20:41:15 +0500 Subject: [PATCH] server: add deploy action --- .github/workflows/deploy.yml | 43 ++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000000000..35007aa131107 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,43 @@ +name: Deploy + +concurrency: + group: deploy + +on: + workflow_dispatch: + inputs: + # ci_required: + # description: 'CI Suite is required' + # type: boolean + # required: true + # default: true + perform_deploy_sierra: + description: 'Deploy SierraBay' + type: boolean + required: true + default: true + +jobs: + # CI: + # uses: ./.github/workflows/ci.yml # use the callable tests job to run tests + # if: ${{ inputs.ci_required }} + + deploy-sierra: + name: Deploy SierraBay + runs-on: ubuntu-latest + # needs: [CI] + if: always() && !cancelled() && !failure() && inputs.perform_deploy_sierra + + steps: + - name: Update and Build SierraBay + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.PRODUCTION_HOST }} + username: ${{ secrets.PRODUCTION_USERNAME }} + key: ${{ secrets.PRODUCTION_SSH_KEY }} + passphrase: ${{ secrets.PRODUCTION_SSH_KEY_PASS }} + script: | + TIME=$(date +'%Y-%m-%d%T') + sudo systemctl --wait start deploy-sierrabay + journalctl --since $TIME -u deploy-sierrabay --no-pager --all + systemctl is-failed deploy-sierrabay | grep -q "failed" && echo "Deployment Failed!" && exit 1 || exit 0