cicd port ozgardi
Some checks failed
Deploy to Production / build-and-deploy (push) Failing after 2m46s

This commit is contained in:
Husanjonazamov
2026-02-12 18:43:28 +05:00
parent a8503b5e15
commit ac51403c1d

View File

@@ -8,6 +8,7 @@ on:
env:
PROJECT_NAME: sifatbaho
permissions:
contents: write
@@ -111,54 +112,37 @@ jobs:
key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }}
script: |
set -e
PROJECTS=/opt/projects/
DIR=/opt/projects/${{ env.PROJECT_NAME }}/
PROJECTS=/opt/projects
DIR=/opt/projects/${{ env.PROJECT_NAME }}
mkdir -p "$PROJECTS"
if [ -d "$PROJECTS" ]; then
echo "projects papkasi mavjud"
# Gitea SSH port: 2222
mkdir -p ~/.ssh
cat >> ~/.ssh/config <<'EOF'
Host gitea.felixits.uz
HostName gitea.felixits.uz
User git
Port 2222
IdentityFile /root/.ssh/gitea_sifatbaho
IdentitiesOnly yes
StrictHostKeyChecking no
EOF
chmod 600 ~/.ssh/config
# Clone (agar yo'q bo'lsa) yoki update
if [ -d "$DIR/.git" ]; then
echo "loyiha mavjud"
else
rm -rf "$DIR"
cd "$PROJECTS"
git clone ssh://git@gitea.felixits.uz:2222/${{ github.repository }}.git "${{ env.PROJECT_NAME }}"
echo "Clone qilindi"
mkdir -p $PROJECTS
echo "projects papkasi yaratildi"
fi
cd "$DIR"
if [ -d "$DIR" ]; then
echo "loyiha mavjud"
else
cd $PROJECTS
git clone git@gitea.felixits.uz:${{ github.repository }}.git ${{ env.PROJECT_NAME }}
echo "Clone qilindi";
fi
cd $DIR
git fetch origin main
git reset --hard origin/main
cp .env.example .env
update_env() {
local env_file=".env"
cp .env.example "$env_file"
for kv in "$@"; do
local key="${kv%%=*}"
local value="${kv#*=}"
if grep -q "^$key=" "$env_file"; then
sed -i "s|^$key=.*|$key=$value|" "$env_file"
else
echo "$key=$value" >> "$env_file"
fi
done
}
@@ -167,6 +151,5 @@ jobs:
"DB_NAME=sifatbaho" \
"DB_PORT=5432"
export PORT=8051
export PORT=8085
docker stack deploy -c stack.yaml ${{ env.PROJECT_NAME }} --with-registry-auth