|
| 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/mysql-action@v1.1 |
| 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 domains |
| 55 | + cd lcommerce.net |
| 56 | + git pull |
| 57 | + composer install |
| 58 | + php artisan migrate --force |
0 commit comments