From 8cb7640f11b715961538889e1178b3fede640bde Mon Sep 17 00:00:00 2001 From: Karthik Sivadas Date: Mon, 15 Apr 2024 16:33:39 +0530 Subject: [PATCH] feat: Add github action to deploy main (#44) --- .github/workflows/deploy-main.yml | 35 +++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/deploy-main.yml diff --git a/.github/workflows/deploy-main.yml b/.github/workflows/deploy-main.yml new file mode 100644 index 00000000..a85534ac --- /dev/null +++ b/.github/workflows/deploy-main.yml @@ -0,0 +1,35 @@ +name: Deploy main + +on: + push: + branches: + - main + paths: + - "ui/**" + - "server/**" + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up SSH key + env: + SSH_KEY_BASE64: ${{ secrets.SSH_KEY_BASE64 }} + run: | + echo "$SSH_KEY_BASE64" | base64 --decode > ${HOME}/multiwoven-deployments.pem + chmod 600 ${HOME}/multiwoven-deployments.pem + + - name: Deploy main + env: + SSH_HOST: ${{ secrets.SSH_HOST }} + SSH_USER: ${{ secrets.SSH_USER }} + run: | + ssh -o StrictHostKeyChecking=no -i ${HOME}/multiwoven-deployments.pem $SSH_USER@$SSH_HOST << 'EOF' + cd multiwoven + git pull origin main + docker-compose down + docker-compose up -d --build + EOF