Skip to content

Instantly share code, notes, and snippets.

@fixable11
Last active June 10, 2021 16:36
Show Gist options
  • Save fixable11/8c285aed5cdb69efdc3c47e0500dc4f2 to your computer and use it in GitHub Desktop.
Save fixable11/8c285aed5cdb69efdc3c47e0500dc4f2 to your computer and use it in GitHub Desktop.
before_script:
- echo 'Before script'
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- mkdir -p ~/.ssh
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- chmod 700 ~/.ssh
- ssh-keyscan -H 'domain.com' >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
building:
stage: build
script:
- ssh root@domain.com "cd /var/www/main/ &&
git checkout -f master &&
git pull origin master &&
cd /var/www/main/back/ &&
composer install -no-dev &&
php artisan key:generate &&
php artisan migrate &&
php artisan cache:clear &&
php artisan config:clear &&
php artisan storage:link -q &&
sudo chown -R fixable:www-data /var/www/main/back &&
sudo chmod 775 -R /var/www/main/back &&
sudo chgrp -R www-data /var/www/main/back/storage /var/www/main/back/bootstrap/cache &&
sudo chmod -R ug+rwx /var/www/main/back/storage /var/www/main/back/bootstrap/cache
"
only:
refs:
- pipeline
deploying:
stage: deploy
script:
- echo "Deployed"
only:
refs:
- pipeline
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment