Created
March 26, 2020 19:25
-
-
Save rorymcdaniel/ac6929bd71cdd31d3683b4f54457a60a 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
Need to set up the following secrets in the repository: