-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Deploy | ||
|
||
# Trigger the workflow on push and | ||
# pull request events on the production branch | ||
on: | ||
push: | ||
branches: | ||
- production | ||
pull_request: | ||
branches: | ||
- production | ||
|
||
# Authenticate to the the server via ssh | ||
# and run our deployment script | ||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Deploy to server | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.HOST }} | ||
username: ${{ secrets.USERNAME }} | ||
port: ${{ secrets.PORT }} | ||
key: ${{ secrets.SSHKEY }} | ||
script: "cd /home/UpdateServer/web/update.techscode.com/public_html/ && deploy.sh" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
echo "Deployment started ..." | ||
|
||
# Enter maintenance mode or return true | ||
# if already is in maintenance mode | ||
(php artisan down) || true | ||
|
||
# Pull the latest version of the app | ||
git pull origin production | ||
|
||
# Install composer dependencies | ||
composer install --no-dev --no-interaction --prefer-dist --optimize-autoloader | ||
|
||
# Clear the old cache | ||
php artisan clear-compiled | ||
|
||
# Recreate cache | ||
php artisan optimize | ||
|
||
# Compile npm assets | ||
npm run prod | ||
|
||
# Run database migrations | ||
php artisan migrate --force | ||
|
||
# Exit maintenance mode | ||
php artisan up | ||
|
||
echo "Deployment finished!" |