Merge pull request #46 from danial117/admin_dev_33 #72
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |