-
Notifications
You must be signed in to change notification settings - Fork 41
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
1 parent
1bd5fbf
commit 978125d
Showing
1 changed file
with
54 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,54 @@ | ||
name: HostingerDeploy | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.2' | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
- name: Copy .env | ||
run: cp .env.example .env | ||
- name: Install composer Dependencies | ||
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist | ||
- name: Install node dependencies | ||
run: npm ci | ||
- name: Setup Project | ||
run: | | ||
php artisan config:clear | ||
php artisan cache:clear | ||
php artisan key:generate | ||
npm run build | ||
- name: Directory Permissions | ||
run: chmod 755 -R storage bootstrap/cache | ||
deploy: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- name: Deploy PHP to Server | ||
if: ${{ success() }} | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.SSH_HOST }} | ||
username: ${{ secrets.SSH_USERNAME }} | ||
port: ${{ secrets.SSH_PORT }} | ||
key: ${{ secrets.SSH_KEY }} | ||
script_stop: true | ||
script: | | ||
cd domains | ||
cd laravel-space.com | ||
git pull | ||
php composer.phar install | ||
php artisan migrate --force | ||
- name: Copy Build Files to Target Server | ||
run: | | ||
rsync -r -e "ssh -p ${{ secrets.SSH_PORT }}" ${{ github.workspace }}/public/build/ ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }}:~/domains/laravel-space.com/public/build | ||
env: | ||
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} |