Posodobitev workflow skripte za podporo več metod prenosa datotek (rsync ali tar)
Deploy to Test Server / deploy (push) Successful in 13s
Details
Deploy to Test Server / deploy (push) Successful in 13s
Details
This commit is contained in:
parent
58752d1e42
commit
2420fe6ed6
|
|
@ -36,6 +36,29 @@ jobs:
|
||||||
echo "SSH ključ ustvarjen iz skrivnosti"
|
echo "SSH ključ ustvarjen iz skrivnosti"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
- name: Install rsync
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
# Preverimo, ali lahko namestimo rsync
|
||||||
|
echo "Preverjanje možnosti namestitve rsync..."
|
||||||
|
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
|
||||||
|
|
||||||
|
# Preverimo, ali je rsync nameščen
|
||||||
|
if command -v rsync &> /dev/null; then
|
||||||
|
echo "rsync je nameščen, verzija:"
|
||||||
|
rsync --version | head -n 1
|
||||||
|
else
|
||||||
|
echo "rsync ni nameščen, uporabili bomo tar"
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Deploy to test server
|
- name: Deploy to test server
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
|
@ -54,8 +77,15 @@ 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/*"
|
||||||
|
|
||||||
# Naredimo direktno kopiranje z rsync
|
# Poskusimo najprej z rsync, če je nameščen
|
||||||
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/
|
if command -v rsync &> /dev/null; then
|
||||||
|
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/
|
||||||
|
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/"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue