Skip to content

Instantly share code, notes, and snippets.

@solipa365
Created November 18, 2024 21:09
Show Gist options
  • Save solipa365/74e9d8c1efd2309bf463855d7c8e4600 to your computer and use it in GitHub Desktop.
Save solipa365/74e9d8c1efd2309bf463855d7c8e4600 to your computer and use it in GitHub Desktop.
stages:
- deploy
production-deploy:
stage: deploy
environment: production
only:
- /^v.*$/
script:
- which ssh-agent || (apt-get update -y && apt-get install openssh-client -y)
- eval "$(ssh-agent -s)"
- echo "$SSH_PRIVATE_KEY" | tr -d "\r" | ssh-add -
- ssh -o "StrictHostKeyChecking=no" "$SSH_USER@$SSH_HOST" "
cd '$PROJECT_PATH' &&
php8.2 artisan down &&
git fetch --all --tags --prune &&
git checkout '$CI_COMMIT_REF_NAME' &&
php8.2 composer.phar install --no-ansi --no-dev --no-interaction --no-plugins --no-progress --no-scripts --optimize-autoloader &&
php8.2 artisan optimize:clear &&
php8.2 artisan schedule:interrupt &&
php8.2 artisan schedule:clear-cache &&
php8.2 artisan migrate --force &&
php8.2 artisan route:cache &&
php8.2 artisan view:cache &&
php8.2 artisan config:cache &&
npm ci &&
npm run build &&
php8.2 artisan up"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment