fix(deploy-preprod file)
Some checks failed
Deploy Roxane to Preprod / deploy (push) Failing after 29s

This commit is contained in:
2025-12-21 13:11:40 +01:00
parent 6a1fca0765
commit eacb6dff58

View File

@@ -7,78 +7,83 @@ on:
jobs: jobs:
deploy: deploy:
runs-on: ubuntu-latest runs-on: docker
container: container:
image: nebulaed/php83-node22 image: nebulaed/php83-node22
steps: steps:
- name: Install network tools - name: Install network & SSH tools
run: | run: |
set -e
apt update apt update
apt install -y iproute2 iputils-ping apt install -y iproute2 iputils-ping openssh-client git
- name: Show network - name: Show IPv6 network
run: | run: |
ip -6 addr ip -6 addr
ip -6 route ip -6 route
- name: Ping IPv6 server - name: Ping IPv6 preprod server
run: | run: |
ping6 -c 3 2a01:e0a:bfe:a8a0::205 || true ping6 -c 3 2a01:e0a:bfe:a8a0::205
- name: Configure SSH - name: Configure SSH
env: env:
SSH_HOST: ${{ vars.PREPROD_HOST }} SSH_HOST: ${{ vars.PREPROD_HOST }}
SSH_PORT: ${{ vars.PREPROD_PORT }} SSH_PORT: ${{ vars.PREPROD_PORT }}
run: | run: |
set -e
mkdir -p ~/.ssh mkdir -p ~/.ssh
chmod 700 ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519 echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519 chmod 600 ~/.ssh/id_ed25519
ssh-keyscan -p "$SSH_PORT" "$SSH_HOST" >> ~/.ssh/known_hosts
case "$SSH_HOST" in case "$SSH_HOST" in
*:*) SSH_HOST_SSH="[$SSH_HOST]" ;; *:*) SSH_HOST_SSH="[$SSH_HOST]" ;;
*) SSH_HOST_SSH="$SSH_HOST" ;; *) SSH_HOST_SSH="$SSH_HOST" ;;
esac esac
echo "Host used for SSH: $SSH_HOST_SSH" echo "SSH_HOST_SSH=$SSH_HOST_SSH" >> "$GITEA_ENV"
# Ajoute l'hôte dans known_hosts - name: Deploy Roxane to preprod
ssh-keyscan -t ed25519 -p "$SSH_PORT" "$SSH_HOST" >> ~/.ssh/known_hosts
# Exporte pour usage dans les étapes suivantes
echo "SSH_HOST_SSH=$SSH_HOST_SSH" >> $GITHUB_ENV
- name: Deploy Roxane
env: env:
SSH_USER: ${{ vars.PREPROD_USER }} SSH_USER: ${{ vars.PREPROD_USER }}
SSH_PORT: ${{ vars.PREPROD_PORT }} SSH_PORT: ${{ vars.PREPROD_PORT }}
SSH_HOST_SSH: ${{ env.SSH_HOST_SSH }}
PREPROD_PATH: ${{ vars.PREPROD_PATH }} PREPROD_PATH: ${{ vars.PREPROD_PATH }}
run: | run: |
ssh -p "$SSH_PORT" "$SSH_USER@$SSH_HOST_SSH" <<'ENDSSH' set -e
set -e
cd $PREPROD_PATH
echo "Pulling latest Roxane release..." ssh -o StrictHostKeyChecking=yes \
git pull origin release -p "$SSH_PORT" \
"$SSH_USER@$SSH_HOST_SSH" <<EOF
set -e
echo "Installing Composer dependencies..." cd "$PREPROD_PATH"
composer install --no-dev --optimize-autoloader --no-interaction
echo "Building frontend with Vite..." echo "Pulling latest Roxane release..."
npm ci git fetch origin
npm run build git checkout release
git pull origin release
echo "Running database migrations..." echo "Installing Composer dependencies..."
php artisan migrate --force composer install --no-dev --optimize-autoloader --no-interaction
echo "Optimizing Roxane..." echo "Building frontend with Vite..."
php artisan optimize npm ci
npm run build
echo "Restarting queue workers..." echo "Running database migrations..."
php artisan queue:restart || true php artisan migrate --force
echo "Roxane deployed successfully to preprod!" echo "Optimizing Roxane..."
ENDSSH php artisan optimize
echo "Restarting queue workers..."
php artisan queue:restart || true
echo "Roxane deployed successfully to preprod!"
EOF