Skip to content

Merge pull request #36 from danial117/client_dev_44 #66

Merge pull request #36 from danial117/client_dev_44

Merge pull request #36 from danial117/client_dev_44 #66

Workflow file for this run

name: SSH Client CICD
on:
push:
branches:
- client
jobs:
ssh-folder-management:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up SSH client
run: |
sudo apt-get update
sudo apt-get install -y sshpass
- name: Connect to SSH and perform operations
env:
SERVER_IP: ${{ secrets.SERVER_IP }}
SERVER_USER: ${{ secrets.SERVER_USER }}
SERVER_PASSWORD: ${{ secrets.SERVER_PASSWORD }}
run: |
sshpass -p "$SERVER_PASSWORD" ssh -o StrictHostKeyChecking=no "$SERVER_USER@$SERVER_IP" << 'EOF'
# Navigate to the target directory
cd /home/infovit/htdocs/www.infovit.us || exit
# Delete all files and directories except 'public'
find . -mindepth 1 -maxdepth 1 ! -name 'public' -exec rm -rf {} +
# Remove all contents inside 'public' directory
find public -mindepth 1 -exec rm -rf {} +
# Clone the specific branch of the GitHub repository into a temporary directory
git clone -b client https://github.com/danial117/Pharma.git ./git
# Navigate to the temporary repository directory
cd ./git || exit
# Install dependencies and build the project
npm install
npm run build
# Move build files to the target directory
mv build/* ../
# Clean up by removing the temporary directory
cd ..
rm -rf ./git
EOF