napisan workflow
Deploy to Production on Develop Push / deploy (push) Failing after 41s
Details
Deploy to Production on Develop Push / deploy (push) Failing after 41s
Details
This commit is contained in:
parent
47d608deb0
commit
5a7740c729
|
|
@ -0,0 +1,44 @@
|
||||||
|
name: Deploy to Production on Develop Push
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- develop # Sproži se samo ob pushu na 'develop' vejo
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
runs-on: ubuntu-latest # Uporabi standardni Linux runner
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
# Ta korak prenese kodo iz vašega repozitorija v delovno okolje runnerja
|
||||||
|
|
||||||
|
- name: Check and Install rsync
|
||||||
|
run: |
|
||||||
|
if command -v rsync &> /dev/null; then
|
||||||
|
echo "rsync is already installed."
|
||||||
|
else
|
||||||
|
echo "rsync not found. Installing..."
|
||||||
|
sudo apt-get update && sudo apt-get install -y rsync
|
||||||
|
fi
|
||||||
|
# Preveri, če je rsync na voljo. Če ni, ga namesti.
|
||||||
|
|
||||||
|
- name: Deploy to Server via rsync
|
||||||
|
env:
|
||||||
|
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||||
|
# Naloži zasebni SSH ključ iz Gitea skrivnosti
|
||||||
|
run: |
|
||||||
|
# Zaženemo ssh-agent in mu dodamo zasebni ključ
|
||||||
|
eval $(ssh-agent -s)
|
||||||
|
echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
|
||||||
|
|
||||||
|
# Izvedemo rsync ukaz za sinhronizacijo
|
||||||
|
# -a: arhivski način (ohrani pravice, lastnika, itd.)
|
||||||
|
# -v: izpisuje podrobnosti (verbose)
|
||||||
|
# -z: stisne podatke med prenosom
|
||||||
|
# --delete: izbriše datoteke na cilju, ki ne obstajajo več v izvoru
|
||||||
|
# -e: določi ukaz za povezavo (ssh z vašim portom)
|
||||||
|
rsync -avz --delete -e "ssh -p ${{ secrets.SSH_PORT }} -o StrictHostKeyChecking=no" \
|
||||||
|
./ \
|
||||||
|
${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:${{ secrets.TARGET_DIR }}
|
||||||
|
|
@ -1,26 +1,57 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Set the output file
|
# Nastavitev imena izhodne datoteke
|
||||||
OUTPUT_FILE="code_export.txt"
|
OUTPUT_FILE="code_export.txt"
|
||||||
|
|
||||||
# Remove the output file if it exists
|
# Odstrani izhodno datoteko, če že obstaja, da začnemo s čisto datoteko
|
||||||
if [ -f "$OUTPUT_FILE" ]; then
|
if [ -f "$OUTPUT_FILE" ]; then
|
||||||
rm "$OUTPUT_FILE"
|
rm "$OUTPUT_FILE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Find all files except hidden files and directories
|
# Poišči vse datoteke, razen skritih datotek in določenih map (npr. node_modules).
|
||||||
find . -type f -not -path "*/\.*" -not -path "*node_modules*" -not -path "*vendor*" | sort | while read -r file; do
|
# Dodane so izjeme za slike, videoposnetke, PDF-je, arhive in druge binarne datoteke
|
||||||
# Skip the output file itself and this script
|
# neposredno v ukaz 'find' za boljšo zmogljivost.
|
||||||
|
find . -type f \
|
||||||
|
-not -path "*/\.*" \
|
||||||
|
-not -path "*node_modules*" \
|
||||||
|
-not -path "*vendor*" \
|
||||||
|
-not -path "*dist*" \
|
||||||
|
-not -path "*build*" \
|
||||||
|
-not -name "*.jpg" -not -name "*.jpeg" \
|
||||||
|
-not -name "*.png" -not -name "*.gif" \
|
||||||
|
-not -name "*.bmp" -not -name "*.tiff" \
|
||||||
|
-not -name "*.svg" -not -name "*.ico" \
|
||||||
|
-not -name "*.webp" \
|
||||||
|
-not -name "*.mp4" -not -name "*.mov" \
|
||||||
|
-not -name "*.avi" -not -name "*.mkv" \
|
||||||
|
-not -name "*.webm" \
|
||||||
|
-not -name "*.mp3" -not -name "*.wav" \
|
||||||
|
-not -name "*.ogg" -not -name "*.flac" \
|
||||||
|
-not -name "*.pdf" \
|
||||||
|
-not -name "*.zip" \
|
||||||
|
-not -name "*.tar" \
|
||||||
|
-not -name "*.gz" \
|
||||||
|
-not -name "*.bz2" \
|
||||||
|
-not -name "*.rar" \
|
||||||
|
-not -name "*.7z" \
|
||||||
|
-not -name "*.doc" -not -name "*.docx" \
|
||||||
|
-not -name "*.xls" -not -name "*.xlsx" \
|
||||||
|
-not -name "*.ppt" -not -name "*.pptx" \
|
||||||
|
-not -name "*.eot" -not -name "*.ttf" \
|
||||||
|
-not -name "*.woff" -not -name "*.woff2" \
|
||||||
|
| sort | while read -r file; do
|
||||||
|
|
||||||
|
# Preskoči samo izhodno datoteko in to skripto
|
||||||
if [[ "$file" == "./$OUTPUT_FILE" || "$file" == "./export_code.sh" ]]; then
|
if [[ "$file" == "./$OUTPUT_FILE" || "$file" == "./export_code.sh" ]]; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Skip binary files and the output file itself
|
# Dodatna varnostna preverba: preskoči binarne datoteke, ki jih 'find' morda ni ujel
|
||||||
if file "$file" | grep -q "binary"; then
|
if file "$file" | grep -q "binary"; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Add the filename and content to the output file
|
# Dodaj ime datoteke in njeno vsebino v izhodno datoteko
|
||||||
echo "\"$file\" : " >> "$OUTPUT_FILE"
|
echo "\"$file\" : " >> "$OUTPUT_FILE"
|
||||||
echo "\"\"\"" >> "$OUTPUT_FILE"
|
echo "\"\"\"" >> "$OUTPUT_FILE"
|
||||||
cat "$file" >> "$OUTPUT_FILE"
|
cat "$file" >> "$OUTPUT_FILE"
|
||||||
|
|
@ -29,4 +60,4 @@ find . -type f -not -path "*/\.*" -not -path "*node_modules*" -not -path "*vendo
|
||||||
echo "" >> "$OUTPUT_FILE"
|
echo "" >> "$OUTPUT_FILE"
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "Code export completed. Output saved to $OUTPUT_FILE"
|
echo "Izvoz kode končan. Vsebina je shranjena v datoteko $OUTPUT_FILE"
|
||||||
Loading…
Reference in New Issue