Skip to content

Merge pull request #43 from danial117/admin_dev_12 #69

Merge pull request #43 from danial117/admin_dev_12

Merge pull request #43 from danial117/admin_dev_12 #69

Workflow file for this run

name: SSH Admin CICD
on:
push:
branches:
- admin
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-secure/htdocs/secure.infovit.us || exit
# delete all content
find . -mindepth 1 -maxdepth 1 -exec rm -rf {} +
# Clone the specific branch of the GitHub repository into a temporary directory
git clone -b admin 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 dist/* ../
# Clean up by removing the temporary directory
cd ..
rm -rf ./git
EOF