Posodobitev workflow skripte za pravilno uporabo SSH ključa iz secrets
Deploy to Test Server / deploy (push) Failing after 4s
Details
Deploy to Test Server / deploy (push) Failing after 4s
Details
This commit is contained in:
parent
14cddf9a0c
commit
58752d1e42
|
|
@ -12,16 +12,52 @@ jobs:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set SSH key permissions
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
# Izpis trenutne delovne mape in seznama datotek
|
||||||
|
pwd
|
||||||
|
ls -la
|
||||||
|
ls -la .gitea/runner/ || echo "Mapa runner ne obstaja"
|
||||||
|
|
||||||
|
# Poskusimo najti SSH ključ
|
||||||
|
find . -name "id_rsa_gitea*" -type f
|
||||||
|
|
||||||
|
# Uporabimo SSH ključ v bazi repozitorija
|
||||||
|
if [ -f ".gitea/runner/id_rsa_gitea" ]; then
|
||||||
|
chmod 600 .gitea/runner/id_rsa_gitea
|
||||||
|
echo "SSH ključ najden in nastavljen"
|
||||||
|
else
|
||||||
|
echo "SSH ključ ni bil najden na pričakovani lokaciji!"
|
||||||
|
# Ustvarimo SSH ključ iz kodiranega besedila
|
||||||
|
mkdir -p ~/.ssh
|
||||||
|
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa_gitea
|
||||||
|
chmod 600 ~/.ssh/id_rsa_gitea
|
||||||
|
echo "SSH ključ ustvarjen iz skrivnosti"
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Deploy to test server
|
- name: Deploy to test server
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
# Najprej preverimo SSH povezavo
|
||||||
|
if [ -f ".gitea/runner/id_rsa_gitea" ]; then
|
||||||
|
SSH_KEY=".gitea/runner/id_rsa_gitea"
|
||||||
|
else
|
||||||
|
SSH_KEY="~/.ssh/id_rsa_gitea"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Uporabljam SSH ključ: $SSH_KEY"
|
||||||
|
|
||||||
|
# Testiranje SSH povezave
|
||||||
|
ssh -p 5050 -i "$SSH_KEY" -o StrictHostKeyChecking=no forexana@152.89.234.215 "echo 'SSH povezava uspešna'"
|
||||||
|
|
||||||
# Izbrišemo obstoječo vsebino v mapi vtičnika
|
# Izbrišemo obstoječo vsebino v mapi vtičnika
|
||||||
ssh -p 5050 -i $GITHUB_WORKSPACE/.gitea/runner/id_rsa_gitea -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
|
# Naredimo direktno kopiranje z rsync
|
||||||
rsync -avz -e "ssh -p 5050 -i $GITHUB_WORKSPACE/.gitea/runner/id_rsa_gitea -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/
|
||||||
|
|
||||||
# Nastavimo pravilna dovoljenja
|
# Nastavimo pravilna dovoljenja
|
||||||
ssh -p 5050 -i $GITHUB_WORKSPACE/.gitea/runner/id_rsa_gitea -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/"
|
||||||
|
|
||||||
echo "Deployment completed successfully!"
|
echo "Deployment completed successfully!"
|
||||||
Loading…
Reference in New Issue