-
-
Save Medalink/e80eef4931859e242d828609e9860324 to your computer and use it in GitHub Desktop.
Starter Github workflow file for Laravel projects
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
name: CI | |
on: | |
push: | |
pull_request: | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
name: Tests | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Cache dependencies | |
uses: actions/cache@v1 | |
with: | |
path: ~/.composer/cache/files | |
key: dependencies-composer-${{ hashFiles('composer.json') }} | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 7.4 | |
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, imagick | |
tools: pecl | |
coverage: none | |
- name: Copy ENV Laravel Configuration for CI | |
run: php -r "file_exists('.env') || copy('.env.example', '.env');" | |
- name: Setup Composer Nova Auth | |
run: composer config http-basic.nova.laravel.com ${{ secrets.NOVA_USERNAME }} ${{ secrets.NOVA_PASSWORD }} | |
- name: Install Composer dependencies | |
run: composer install --prefer-dist --no-interaction --no-suggest | |
- name: Set app key | |
run: php artisan key:generate | |
- name: Install NPM dependencies | |
run: npm install | |
- name: Compile assets | |
run: npm run production | |
- name: Execute tests | |
run: vendor/bin/phpunit --verbose | |
- name: Deploy to staging | |
if: github.ref == 'refs/heads/develop' | |
uses: bredmor/vapor-action@master | |
env: | |
VAPOR_API_TOKEN: ${{ secrets.VAPOR_API_TOKEN }} | |
GITHUB_SECRET: ${{ secrets.GITHUB_SECRET }} | |
with: | |
args: deploy staging | |
- name: Deploy to production | |
if: github.ref == 'refs/heads/master' | |
uses: bredmor/vapor-action@master | |
env: | |
VAPOR_API_TOKEN: ${{ secrets.VAPOR_API_TOKEN }} | |
GITHUB_SECRET: ${{ secrets.GITHUB_SECRET }} | |
with: | |
args: deploy production | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment