Created
April 25, 2021 17:10
-
-
Save imansprn/259bbdd93f6752e2788f9ff50ebae54b to your computer and use it in GitHub Desktop.
Laravel deployer on Github Action
This file contains hidden or 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
| name: Deploy | |
| on: | |
| push: | |
| branches: [ master ] | |
| jobs: | |
| Deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: shivammathur/setup-php@b7d1d9c9a92d8d8463ce36d7f60da34d461724f8 | |
| with: | |
| php-version: '7.3' | |
| extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite | |
| coverage: none | |
| - uses: actions/checkout@v2 | |
| - name: Copy .env | |
| run: php -r "file_exists('.env') || copy('.env.example', '.env');" | |
| - name: Install Dependencies | |
| run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist | |
| - name: Generate key | |
| run: php artisan key:generate | |
| - name: Directory Permissions | |
| run: chmod -R 777 storage bootstrap/cache | |
| - name: Create Database | |
| run: | | |
| mkdir -p database | |
| touch database/database.sqlite | |
| - name: Execute tests (Unit and Feature tests) via PHPUnit | |
| env: | |
| DB_CONNECTION: sqlite | |
| DB_DATABASE: database/database.sqlite | |
| run: vendor/bin/phpunit | |
| - name: Setup Deployer | |
| uses: atymic/deployer-php-action@master | |
| with: | |
| ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
| ssh-known-hosts: ${{ secrets.SSH_KNOWN_HOSTS }} | |
| - name: Deploy | |
| env: | |
| DOT_ENV: ${{ secrets.DOT_ENV_PRODUCTION }} | |
| run: dep deploy production --tag=${{ env.GITHUB_REF }} -vvv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment