85 lines
2.0 KiB
YAML
85 lines
2.0 KiB
YAML
name: Deploy Roxane to Preprod
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- release
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: docker
|
|
|
|
container:
|
|
image: nebulaed/php83-node22
|
|
|
|
steps:
|
|
- name: Install network & SSH tools
|
|
run: |
|
|
set -e
|
|
apt update
|
|
apt install -y iproute2 iputils-ping openssh-client git
|
|
|
|
- name: Show IPv6 network
|
|
run: |
|
|
ip -6 addr
|
|
ip -6 route
|
|
|
|
- name: Ping IPv6 preprod server
|
|
run: |
|
|
ping6 -c 3 2a01:e0a:bfe:a8a0::205
|
|
|
|
- name: Configure SSH
|
|
env:
|
|
SSH_HOST: ${{ vars.PREPROD_HOST }}
|
|
SSH_PORT: ${{ vars.PREPROD_PORT }}
|
|
run: |
|
|
set -e
|
|
mkdir -p ~/.ssh
|
|
chmod 700 ~/.ssh
|
|
|
|
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519
|
|
chmod 600 ~/.ssh/id_ed25519
|
|
|
|
ssh-keyscan -6 -p "$SSH_PORT" "$SSH_HOST" >> ~/.ssh/known_hosts
|
|
|
|
echo "SSH_HOST_SSH=$SSH_HOST" >> "$GITEA_ENV"
|
|
|
|
- name: Deploy Roxane to preprod
|
|
env:
|
|
SSH_USER: ${{ vars.PREPROD_USER }}
|
|
SSH_PORT: ${{ vars.PREPROD_PORT }}
|
|
PREPROD_PATH: ${{ vars.PREPROD_PATH }}
|
|
run: |
|
|
set -e
|
|
|
|
ssh -6 -o StrictHostKeyChecking=yes \
|
|
-p "$SSH_PORT" \
|
|
"$SSH_USER@$SSH_HOST_SSH" <<'EOF'
|
|
set -e
|
|
|
|
cd "$PREPROD_PATH"
|
|
|
|
echo "Pulling latest Roxane release..."
|
|
git fetch origin
|
|
git checkout release
|
|
git reset --hard origin/release
|
|
|
|
echo "Installing Composer dependencies..."
|
|
composer install --no-dev --optimize-autoloader --no-interaction
|
|
|
|
echo "Building frontend with Vite..."
|
|
npm ci
|
|
npm run build
|
|
|
|
echo "Running database migrations..."
|
|
php artisan migrate --force
|
|
|
|
echo "Optimizing Roxane..."
|
|
php artisan optimize
|
|
|
|
echo "Restarting queue workers..."
|
|
php artisan queue:restart || true
|
|
|
|
echo "Roxane deployed successfully to preprod!"
|
|
EOF
|