From 5f7ee642c3403cd7ce127683b725965a5343ea49 Mon Sep 17 00:00:00 2001 From: Joshua Murithi Date: Fri, 22 Nov 2024 13:00:51 +0300 Subject: [PATCH] Create encryption.yml --- .github/workflows/encryption.yml | 38 ++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/encryption.yml diff --git a/.github/workflows/encryption.yml b/.github/workflows/encryption.yml new file mode 100644 index 0000000..eed8cbd --- /dev/null +++ b/.github/workflows/encryption.yml @@ -0,0 +1,38 @@ +name: Test Instance Deployment + +on: + push: + branches: [main] + +jobs: + deploy: + name: Deploy to Test Instance + runs-on: ubuntu-latest + + steps: + - name: Remote Connection Setup + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + key: ${{ secrets.CICD_SECRET }} + port: ${{ secrets.PORT }} + script: | + # Set up deployment directory + deploy_dir="/apps/github-workflows/mhealth-apps/encryption/ushauri_api" + sudo rm -rf "$deploy_dir" + sudo mkdir "$deploy_dir" + sudo chown -R cicd2:cicd2 "$deploy_dir" + + # Clone repository + git config --global --add safe.directory "$deploy_dir" + git clone -b main https://github.com/palladiumkenya/ushauri_api.git "$deploy_dir" + + # Copy configuration files + cp /apps/configs/ushauri_api_encryption/.env "$deploy_dir/" + + # Build and run Docker container + docker stop ushauri_api_encryption || true + docker rm ushauri_api_encryption || true + docker build -t ushauri_api_encryption:latest "$deploy_dir" + docker run -p 7102:5000 --name ushauri_api_encryption -d --restart always ushauri_api_encryption:latest