Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name: Deploy
name: Deploy to Vapor

on:
push:
branches:
- main
- develop
- releases/**
workflow_dispatch:

jobs:
Expand All @@ -13,30 +14,32 @@ jobs:
uses: lostlink/dotenv/.github/workflows/tlint.yml@main
secrets:
COMPOSER_AUTH_JSON: ${{ secrets.COMPOSER_AUTH_JSON }}

linters-phpcs:
name: Linters
uses: lostlink/dotenv/.github/workflows/phpcs.yml@main
secrets:
COMPOSER_AUTH_JSON: ${{ secrets.COMPOSER_AUTH_JSON }}

linters-phpstan:
name: Linters
uses: lostlink/dotenv/.github/workflows/phpstan.yml@main
secrets:
COMPOSER_AUTH_JSON: ${{ secrets.COMPOSER_AUTH_JSON }}
VAPOR_API_TOKEN: ${{ secrets.VAPOR_API_TOKEN }}

test:
name: Test
uses: lostlink/dotenv/.github/workflows/test.yml@main
secrets:
COMPOSER_AUTH_JSON: ${{ secrets.COMPOSER_AUTH_JSON }}

deploy:
name: Deploy to Vapor
runs-on: ubuntu-latest
needs: [linters-tlint,linters-phpcs,linters-phpstan,test]
concurrency: ${{ github.ref == 'refs/heads/main' && 'production' || 'develop' }} - ${{ matrix.region }}
environment: ${{ github.ref == 'refs/heads/main' && 'production' || 'develop' }}
env:
APP_ENV: ${{ github.ref == 'refs/heads/main' && 'production' || 'develop' }}
concurrency: ${{ contains(github.ref, 'refs/heads/releases/') && 'production' || 'develop' }} - ${{ matrix.region }}
environment: ${{ contains(github.ref, 'refs/heads/releases/') && 'production' || 'develop' }}

strategy:
fail-fast: false
Expand All @@ -52,6 +55,18 @@ jobs:
with:
lfs: true

- name: Set Environment - Production
if: contains(github.ref, 'refs/heads/releases/')
run: echo "APP_ENV=production" >> $GITHUB_ENV

- name: Set Environment - Staging
if: contains(github.ref, 'refs/heads/main')
run: echo "APP_ENV=staging" >> $GITHUB_ENV

- name: Set Environment - Develop
if: contains(github.ref, 'refs/heads/develop') || contains(github.ref, 'refs/heads/feature') || contains(github.ref, 'refs/heads/hotfix')
run: echo "APP_ENV=develop" >> $GITHUB_ENV

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
Expand Down
31 changes: 24 additions & 7 deletions .github/workflows/phpcs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: Linters - PHPCS
on:
push:
branches:
- feature/*
- hotfix/*
- hotfix/**
- feature/**
workflow_call:
secrets:
COMPOSER_AUTH_JSON:
Expand All @@ -14,14 +14,24 @@ jobs:
phpcs:
name: PHPCS
runs-on: ubuntu-latest
environment: ${{ github.ref == 'refs/heads/main' && 'production' || 'develop' }}
env:
APP_ENV: ${{ github.ref == 'refs/heads/main' && 'production' || 'develop' }}
environment: ${{ contains(github.ref, 'refs/heads/releases/') && 'production' || 'develop' }}

steps:
- name: Check out code
uses: actions/checkout@v2

- name: Set Environment - Production
if: contains(github.ref, 'refs/heads/releases/')
run: echo "APP_ENV=production" >> $GITHUB_ENV

- name: Set Environment - Staging
if: contains(github.ref, 'refs/heads/main')
run: echo "APP_ENV=staging" >> $GITHUB_ENV

- name: Set Environment - Develop
if: contains(github.ref, 'refs/heads/develop') || contains(github.ref, 'refs/heads/feature') || contains(github.ref, 'refs/heads/hotfix')
run: echo "APP_ENV=develop" >> $GITHUB_ENV

- name: Cache dependencies
uses: actions/cache@v2
with:
Expand All @@ -41,8 +51,15 @@ jobs:
- name: Install dependencies
run: composer install --prefer-dist --no-interaction --no-progress --no-scripts --ignore-platform-reqs

- name: Remove auth.json file
run: rm -f $GITHUB_WORKSPACE/auth.json

- name: PHPCS lint
run: vendor/bin/duster phpcs

- name: Remove auth.json file
run: rm -f $GITHUB_WORKSPACE/auth.json
- name: Upload artifacts
uses: actions/upload-artifact@v2
if: failure()
with:
name: Logs
path: ./storage/logs
31 changes: 24 additions & 7 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: Linters - PHPStan
on:
push:
branches:
- feature/*
- hotfix/*
- hotfix/**
- feature/**
workflow_call:
secrets:
COMPOSER_AUTH_JSON:
Expand All @@ -16,14 +16,24 @@ jobs:
phpstan:
name: PHPStan
runs-on: ubuntu-latest
environment: ${{ github.ref == 'refs/heads/main' && 'production' || 'develop' }}
env:
APP_ENV: ${{ github.ref == 'refs/heads/main' && 'production' || 'develop' }}
environment: ${{ contains(github.ref, 'refs/heads/releases/') && 'production' || 'develop' }}

steps:
- name: Check out code
uses: actions/checkout@v2

- name: Set Environment - Production
if: contains(github.ref, 'refs/heads/releases/')
run: echo "APP_ENV=production" >> $GITHUB_ENV

- name: Set Environment - Staging
if: contains(github.ref, 'refs/heads/main')
run: echo "APP_ENV=staging" >> $GITHUB_ENV

- name: Set Environment - Develop
if: contains(github.ref, 'refs/heads/develop') || contains(github.ref, 'refs/heads/feature') || contains(github.ref, 'refs/heads/hotfix')
run: echo "APP_ENV=develop" >> $GITHUB_ENV

- name: Cache dependencies
uses: actions/cache@v2
with:
Expand All @@ -43,6 +53,9 @@ jobs:
- name: Install dependencies
run: composer install --prefer-dist --no-interaction --no-progress --no-scripts --ignore-platform-reqs

- name: Remove auth.json file
run: rm -f $GITHUB_WORKSPACE/auth.json

- name: Set VaporFile from Region
run: |
./vapor-switch.sh --region us-east-1 --force
Expand All @@ -57,5 +70,9 @@ jobs:
- name: PHPStan Analyze
run: vendor/bin/phpstan analyze

- name: Remove auth.json file
run: rm -f $GITHUB_WORKSPACE/auth.json
- name: Upload artifacts
uses: actions/upload-artifact@v2
if: failure()
with:
name: Logs
path: ./storage/logs
26 changes: 18 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: Test
on:
push:
branches:
- feature/*
- hotfix/*
- hotfix/**
- feature/**
workflow_call:
secrets:
COMPOSER_AUTH_JSON:
Expand All @@ -14,14 +14,24 @@ jobs:
test:
name: Test
runs-on: ubuntu-latest
environment: ${{ github.ref == 'refs/heads/main' && 'production' || 'develop' }}
env:
APP_ENV: ${{ github.ref == 'refs/heads/main' && 'production' || 'develop' }}
environment: ${{ contains(github.ref, 'refs/heads/releases/') && 'production' || 'develop' }}

steps:
- name: Check out code
uses: actions/checkout@v2

- name: Set Environment - Production
if: contains(github.ref, 'refs/heads/releases/')
run: echo "APP_ENV=production" >> $GITHUB_ENV

- name: Set Environment - Staging
if: contains(github.ref, 'refs/heads/main')
run: echo "APP_ENV=staging" >> $GITHUB_ENV

- name: Set Environment - Develop
if: contains(github.ref, 'refs/heads/develop') || contains(github.ref, 'refs/heads/feature') || contains(github.ref, 'refs/heads/hotfix')
run: echo "APP_ENV=develop" >> $GITHUB_ENV

- name: Setup Node
uses: actions/setup-node@v2
with:
Expand Down Expand Up @@ -50,6 +60,9 @@ jobs:
- name: Install Composer dependencies
run: composer install --prefer-dist --no-interaction --no-progress --no-scripts

- name: Remove auth.json file
run: rm -f $GITHUB_WORKSPACE/auth.json

- name: Copy testing environment config file
run: php -r "file_exists('.env') || copy('.env.testing', '.env');"

Expand All @@ -73,6 +86,3 @@ jobs:
with:
name: Logs
path: ./storage/logs

- name: Remove auth.json file
run: rm -f $GITHUB_WORKSPACE/auth.json
31 changes: 24 additions & 7 deletions .github/workflows/tlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: Linters - TLint
on:
push:
branches:
- feature/*
- hotfix/*
- hotfix/**
- feature/**
workflow_call:
secrets:
COMPOSER_AUTH_JSON:
Expand All @@ -14,14 +14,24 @@ jobs:
tlint:
name: TLint
runs-on: ubuntu-latest
environment: ${{ github.ref == 'refs/heads/main' && 'production' || 'develop' }}
env:
APP_ENV: ${{ github.ref == 'refs/heads/main' && 'production' || 'develop' }}
environment: ${{ contains(github.ref, 'refs/heads/releases/') && 'production' || 'develop' }}

steps:
- name: Check out code
uses: actions/checkout@v2

- name: Set Environment - Production
if: contains(github.ref, 'refs/heads/releases/')
run: echo "APP_ENV=production" >> $GITHUB_ENV

- name: Set Environment - Staging
if: contains(github.ref, 'refs/heads/main')
run: echo "APP_ENV=staging" >> $GITHUB_ENV

- name: Set Environment - Develop
if: contains(github.ref, 'refs/heads/develop') || contains(github.ref, 'refs/heads/feature') || contains(github.ref, 'refs/heads/hotfix')
run: echo "APP_ENV=develop" >> $GITHUB_ENV

- name: Cache dependencies
uses: actions/cache@v2
with:
Expand All @@ -41,8 +51,15 @@ jobs:
- name: Install dependencies
run: composer install --prefer-dist --no-interaction --no-progress --no-scripts --ignore-platform-reqs

- name: Remove auth.json file
run: rm -f $GITHUB_WORKSPACE/auth.json

- name: Tlint Lint
run: vendor/bin/duster tlint

- name: Remove auth.json file
run: rm -f $GITHUB_WORKSPACE/auth.json
- name: Upload artifacts
uses: actions/upload-artifact@v2
if: failure()
with:
name: Logs
path: ./storage/logs