Odstranitev koraka za namestitev rsync, ker je že nameščen na strežniku
Deploy to Production Server / deploy (push) Failing after 4s Details

This commit is contained in:
Mark Poljanšek 2025-06-22 18:47:48 +02:00
parent fc70983ab9
commit f19302be25
2 changed files with 6 additions and 76 deletions

View File

@ -25,35 +25,6 @@ jobs:
chmod 600 ~/.ssh/id_rsa_gitea chmod 600 ~/.ssh/id_rsa_gitea
echo "SSH ključ ustvarjen iz skrivnosti" echo "SSH ključ ustvarjen iz skrivnosti"
- name: Install rsync
shell: bash
run: |
# Najprej preverimo, ali je rsync že nameščen
if command -v rsync &> /dev/null; then
echo "rsync je že nameščen, verzija:"
rsync --version | head -n 1
else
# Če rsync ni nameščen, ga poskušamo namestiti
echo "rsync ni nameščen, poskušam namestiti..."
if command -v apt-get &> /dev/null; then
echo "Poskušam namestiti rsync z apt-get..."
sudo apt-get update && sudo apt-get install -y rsync || echo "Ni mogoče namestiti rsync z apt-get"
elif command -v yum &> /dev/null; then
echo "Poskušam namestiti rsync z yum..."
sudo yum install -y rsync || echo "Ni mogoče namestiti rsync z yum"
else
echo "Ni mogoče namestiti rsync - manjka paketni upravljalnik"
fi
# Ponovno preverimo, ali je namestitev uspela
if command -v rsync &> /dev/null; then
echo "rsync je uspešno nameščen, verzija:"
rsync --version | head -n 1
else
echo "rsync ni uspešno nameščen, uporabili bomo tar"
fi
fi
- name: Deploy to production server - name: Deploy to production server
shell: bash shell: bash
run: | run: |
@ -67,15 +38,9 @@ jobs:
# Izbrišemo obstoječo vsebino v mapi vtičnika v produkcijskem okolju # Izbrišemo obstoječo vsebino v mapi vtičnika v produkcijskem okolju
ssh -p 5050 -i "$SSH_KEY" -o StrictHostKeyChecking=no forexana@152.89.234.215 "rm -rf public_html/wp-content/plugins/custom_wheel\ 2/*" ssh -p 5050 -i "$SSH_KEY" -o StrictHostKeyChecking=no forexana@152.89.234.215 "rm -rf public_html/wp-content/plugins/custom_wheel\ 2/*"
# Poskusimo najprej z rsync, če je nameščen # Prenašanje datotek z rsync
if command -v rsync &> /dev/null; then echo "Prenašanje datotek z rsync..."
echo "Prenašanje datotek z rsync..." rsync -avz -e "ssh -p 5050 -i $SSH_KEY -o StrictHostKeyChecking=no" --exclude=".git" --exclude=".gitea" --exclude="id_rsa_gitea*" ./ forexana@152.89.234.215:public_html/wp-content/plugins/custom_wheel\ 2/
rsync -avz -e "ssh -p 5050 -i $SSH_KEY -o StrictHostKeyChecking=no" --exclude=".git" --exclude=".gitea" --exclude="id_rsa_gitea*" ./ forexana@152.89.234.215:public_html/wp-content/plugins/custom_wheel\ 2/
else
# Alternativna metoda prenosa z uporabo tar preko SSH
echo "Prenašanje datotek s tar preko SSH..."
tar czf - --exclude=".git" --exclude=".gitea" --exclude="id_rsa_gitea*" ./ | ssh -p 5050 -i "$SSH_KEY" -o StrictHostKeyChecking=no forexana@152.89.234.215 "tar xzf - -C public_html/wp-content/plugins/custom_wheel\ 2/"
fi
# Nastavimo pravilna dovoljenja # Nastavimo pravilna dovoljenja
ssh -p 5050 -i "$SSH_KEY" -o StrictHostKeyChecking=no forexana@152.89.234.215 "chmod -R 755 public_html/wp-content/plugins/custom_wheel\ 2/" ssh -p 5050 -i "$SSH_KEY" -o StrictHostKeyChecking=no forexana@152.89.234.215 "chmod -R 755 public_html/wp-content/plugins/custom_wheel\ 2/"

View File

@ -36,35 +36,6 @@ jobs:
echo "SSH ključ ustvarjen iz skrivnosti" echo "SSH ključ ustvarjen iz skrivnosti"
fi fi
- name: Install rsync
shell: bash
run: |
# Najprej preverimo, ali je rsync že nameščen
if command -v rsync &> /dev/null; then
echo "rsync je že nameščen, verzija:"
rsync --version | head -n 1
else
# Če rsync ni nameščen, ga poskušamo namestiti
echo "rsync ni nameščen, poskušam namestiti..."
if command -v apt-get &> /dev/null; then
echo "Poskušam namestiti rsync z apt-get..."
sudo apt-get update && sudo apt-get install -y rsync || echo "Ni mogoče namestiti rsync z apt-get"
elif command -v yum &> /dev/null; then
echo "Poskušam namestiti rsync z yum..."
sudo yum install -y rsync || echo "Ni mogoče namestiti rsync z yum"
else
echo "Ni mogoče namestiti rsync - manjka paketni upravljalnik"
fi
# Ponovno preverimo, ali je namestitev uspela
if command -v rsync &> /dev/null; then
echo "rsync je uspešno nameščen, verzija:"
rsync --version | head -n 1
else
echo "rsync ni uspešno nameščen, uporabili bomo tar"
fi
fi
- name: Deploy to test server - name: Deploy to test server
shell: bash shell: bash
run: | run: |
@ -83,15 +54,9 @@ jobs:
# Izbrišemo obstoječo vsebino v mapi vtičnika # Izbrišemo obstoječo vsebino v mapi vtičnika
ssh -p 5050 -i "$SSH_KEY" -o StrictHostKeyChecking=no forexana@152.89.234.215 "rm -rf test.forexanalysis.com/wp-content/plugins/custom_wheel\ 2/*" ssh -p 5050 -i "$SSH_KEY" -o StrictHostKeyChecking=no forexana@152.89.234.215 "rm -rf test.forexanalysis.com/wp-content/plugins/custom_wheel\ 2/*"
# Poskusimo najprej z rsync, če je nameščen # Prenašanje datotek z rsync
if command -v rsync &> /dev/null; then echo "Prenašanje datotek z rsync..."
echo "Prenašanje datotek z rsync..." rsync -avz -e "ssh -p 5050 -i $SSH_KEY -o StrictHostKeyChecking=no" --exclude=".git" --exclude=".gitea" --exclude="id_rsa_gitea*" ./ forexana@152.89.234.215:test.forexanalysis.com/wp-content/plugins/custom_wheel\ 2/
rsync -avz -e "ssh -p 5050 -i $SSH_KEY -o StrictHostKeyChecking=no" --exclude=".git" --exclude=".gitea" --exclude="id_rsa_gitea*" ./ forexana@152.89.234.215:test.forexanalysis.com/wp-content/plugins/custom_wheel\ 2/
else
# Alternativna metoda prenosa z uporabo tar preko SSH
echo "Prenašanje datotek s tar preko SSH..."
tar czf - --exclude=".git" --exclude=".gitea" --exclude="id_rsa_gitea*" ./ | ssh -p 5050 -i "$SSH_KEY" -o StrictHostKeyChecking=no forexana@152.89.234.215 "tar xzf - -C test.forexanalysis.com/wp-content/plugins/custom_wheel\ 2/"
fi
# Nastavimo pravilna dovoljenja # Nastavimo pravilna dovoljenja
ssh -p 5050 -i "$SSH_KEY" -o StrictHostKeyChecking=no forexana@152.89.234.215 "chmod -R 755 test.forexanalysis.com/wp-content/plugins/custom_wheel\ 2/" ssh -p 5050 -i "$SSH_KEY" -o StrictHostKeyChecking=no forexana@152.89.234.215 "chmod -R 755 test.forexanalysis.com/wp-content/plugins/custom_wheel\ 2/"