Skip to content

Commit 660dbf0

Browse files
committed
Testing github actions
1 parent ac7011a commit 660dbf0

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

.github/.workflows/deploy.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Deploy
2+
3+
on:
4+
push:
5+
branches: [main]
6+
jobs:
7+
deploy:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: shivammathur/setup-php@v2
11+
with:
12+
php-version: '8.1'
13+
- uses: actions/checkout@v2
14+
- uses: actions/setup-node@v3
15+
with:
16+
node-version: 16
17+
- uses: mirromutth/[email protected]
18+
with:
19+
mysql database: laravel-test-db
20+
mysql user: laravel_test_user
21+
mysql password: example
22+
- name: Copy .env
23+
run: cp .env.example .env
24+
- name: Install composer Dependencies
25+
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
26+
- name: Install node dependencies
27+
run: npm ci
28+
- name: Setup Project
29+
run: |
30+
php artisan config:clear
31+
php artisan cache:clear
32+
php artisan key:generate
33+
npm run build
34+
- name: Directory Permissions
35+
run: chmod 755 -R storage bootstrap/cache
36+
- name: Run Unit tests
37+
env:
38+
APP_ENV: testing
39+
DB_CONNECTION: mysql
40+
DB_USERNAME: laravel_test_user
41+
DB_PASSWORD: super_secret
42+
DB_DATABASE: laravel_test_db
43+
run: php artisan test
44+
- name: Deploy to Server
45+
if: ${{ success() }}
46+
uses: appleboy/ssh-action@master
47+
with:
48+
host: ${{ secrets.SSH_HOST }}
49+
port: ${{ secrets.SSH_PORT }}
50+
username: ${{ secrets.SSH_USERNAME }}
51+
key: ${{ secrets.SSH_KEY }}
52+
script_stop: true
53+
script: |
54+
cd apps
55+
cd laravel-example
56+
git pull
57+
npm ci
58+
npm run prod
59+
composer i
60+
php artisan migrate --force

0 commit comments

Comments
 (0)