Skip to content

Commit

Permalink
Merge pull request #56 from satyakresna/master
Browse files Browse the repository at this point in the history
Fix issue #55 and add feature deploy with Github Actions
  • Loading branch information
nafiesl committed Sep 20, 2020
2 parents e666f3b + 93c0017 commit f5af269
Show file tree
Hide file tree
Showing 6 changed files with 11,547 additions and 2 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: CI-CD

on: push

jobs:
compile-assets:
name: Compile assets
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# Build jS
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: '12'
- name: Install dependencies
run: npm ci
- name: NPM Build
run: |
npm run prod
cat public/mix-manifest.json # see version in log
- name: Upload compile assets
uses: actions/upload-artifact@v1
with:
name: assets
path: public
test-php:
name: Test/Lint PHP
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@master
with:
php-version: 7.3
extensions: mbstring, bmath
- name: Composer install
run: composer install
- name: Generate artisan key
run: |
cp .env.example .env
php artisan key:generate
- name: Run tests
run: ./vendor/bin/phpunit
deploy:
name: Deploy to production
runs-on: ubuntu-latest
needs: [compile-assets, test-php]
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
- name: Download build assets
uses: actions/download-artifact@v1
with:
name: assets
path: public
- name: Setup PHP
uses: shivammathur/setup-php@master
with:
php-version: 7.3
extensions: mbstring, bmath
- name: Composer install
run: composer install
- 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 to Prod
run: dep deploy production --tag=${{ env.GITHUB_REF }} -vvv
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
},
"require-dev": {
"barryvdh/laravel-debugbar": "^3.1",
"deployer/deployer": "^6.8",
"deployer/recipes": "^6.2",
"filp/whoops": "^2.0",
"fzaninotto/faker": "^1.4",
"luthfi/simple-crud-generator": "^1.4",
Expand Down

0 comments on commit f5af269

Please sign in to comment.