Skip to content

Commit

Permalink
laravel 10 support (#2)
Browse files Browse the repository at this point in the history
* laravel 10 support
  • Loading branch information
swapnilsarwe committed Feb 18, 2023
1 parent 73c0072 commit 7a83e15
Show file tree
Hide file tree
Showing 6 changed files with 142 additions and 11 deletions.
82 changes: 82 additions & 0 deletions .github/workflows/auto-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Auto Update Icons

on:
schedule:
- cron: '0 12 * * 1'

jobs:
generate:
runs-on: ubuntu-latest

strategy:
fail-fast: true
matrix:
php: [8.0]
laravel: [^8.0]

name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }}

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}

- name: Read DotEnv File
uses: c-py/action-dotenv-to-setenv@v2
with:
env-file: .env

- name: Checkout dependent repo
uses: actions/checkout@v3
with:
repository: ${{ env.REPOSITORY }}
ref: ${{ env.BRANCH }}
path: ./dist

- id: latest-commit
name: Get the latest commit
run: |
echo 'LATEST_COMMIT<<EOF' >> $GITHUB_ENV
cd ./dist && git log --format="%H" -n 1 >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- id: current-commit
name: Get current commot
uses: juliangruber/read-file-action@v1
with:
path: ./.commit

- name: Add versions to environment
run: |
echo "CURRENT_COMMIT=${{ steps.current-commit.outputs.content }}" >> $GITHUB_ENV
- name: Output versions
run: |
echo "Current commit: ${{ env.CURRENT_COMMIT }}"
echo "Latest commit: ${{ env.LATEST_COMMIT }}"
- name: Install dependencies
run: composer update --no-interaction --no-progress --dev

- name: Compile icons to resources directory
if: env.CURRENT_COMMIT != env.LATEST_COMMIT
run: ./vendor/bin/blade-icons-generate

- name: Update commit hash in ".commit"
if: env.CURRENT_COMMIT != env.LATEST_COMMIT
run: echo ${{ env.LATEST_COMMIT }}>./.commit

- name: Create PR for latest version
if: env.CURRENT_COMMIT != env.LATEST_COMMIT
uses: peter-evans/create-pull-request@v3
with:
commit-message: "auto-update: update icons with the latest commit ${{ env.LATEST_COMMIT }}"
committer: GitHub Action <[email protected]>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
title: "chore: update icons with the latest commit v${{ env.LATEST_COMMIT }}"
body: |
This updates from [${{ env.CURRENT_COMMIT }}](https://github.com/${{ env.REPOSITORY }}/commit/${{ env.CURRENT_COMMIT }}) to [${{ env.LATEST_COMMIT }}](https://github.com/${{ env.REPOSITORY }}/commit/${{ env.LATEST_COMMIT }}).
Check out the differences: [`${{ env.CURRENT_COMMIT }}` ... `${{ env.LATEST_COMMIT }}`](https://github.com/${{ env.REPOSITORY }}/compare/${{ env.CURRENT_COMMIT }}...${{ env.LATEST_COMMIT }})
branch: feature/update-${{ env.LATEST_COMMIT }}

40 changes: 40 additions & 0 deletions .github/workflows/php-cs-fixer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Check & fix styling

on: [push]

jobs:
php-cs-fixer:
runs-on: ubuntu-latest

strategy:
fail-fast: true
matrix:
php: [8.0]
laravel: [^8.0]

name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }}

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip
coverage: none

- name: Install dependencies
run: composer update --prefer-dist --no-interaction --no-progress

- name: Run PHP CS Fixer
run: vendor/bin/php-cs-fixer fix

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Fix styling

13 changes: 10 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,24 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [7.4, '8.0', 8.1]
laravel: [8, 9]
php: [7.4, '8.0', 8.1, 8.2]
laravel: [8, 9, 10]
exclude:
- php: 7.4
laravel: 9
- php: 7.4
laravel: 10
- php: '8.0'
laravel: 10
- php: 8.2
laravel: 8

name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }}


steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -38,3 +44,4 @@ jobs:
- name: Execute tests
run: vendor/bin/phpunit --verbose

3 changes: 2 additions & 1 deletion .github/workflows/update-changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ref: main

Expand All @@ -26,3 +26,4 @@ jobs:
branch: main
commit_message: Update CHANGELOG
file_pattern: CHANGELOG.md

5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
"require": {
"php": "^7.4|^8.0",
"blade-ui-kit/blade-icons": "^1.1",
"illuminate/support": "^8.0|^9.0"
"illuminate/support": "^8.0|^9.0|^10.0"
},
"require-dev": {
"codeat3/blade-icon-generation-helpers": "^0.3",
"codeat3/phpcs-styles": "^1.0",
"orchestra/testbench": "^6.0|^7.0",
"orchestra/testbench": "^6.0|^7.0|^8.0",
"phpunit/phpunit": "^9.0"
},
"autoload": {
Expand Down
10 changes: 5 additions & 5 deletions src/BladeElusiveIconsServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
namespace Codeat3\BladeElusiveIcons;

use BladeUI\Icons\Factory;
use Illuminate\Support\ServiceProvider;
use Illuminate\Contracts\Container\Container;
use Illuminate\Support\ServiceProvider;

final class BladeElusiveIconsServiceProvider extends ServiceProvider
{
Expand All @@ -17,24 +17,24 @@ public function register(): void
$this->callAfterResolving(Factory::class, function (Factory $factory, Container $container) {
$config = $container->make('config')->get('blade-elusive-icons', []);

$factory->add('elusive-icons', array_merge(['path' => __DIR__.'/../resources/svg'], $config));
$factory->add('elusive-icons', array_merge(['path' => __DIR__ . '/../resources/svg'], $config));
});
}

private function registerConfig(): void
{
$this->mergeConfigFrom(__DIR__.'/../config/blade-elusive-icons.php', 'blade-elusive-icons');
$this->mergeConfigFrom(__DIR__ . '/../config/blade-elusive-icons.php', 'blade-elusive-icons');
}

public function boot(): void
{
if ($this->app->runningInConsole()) {
$this->publishes([
__DIR__.'/../resources/svg' => public_path('vendor/blade-elusive-icons'),
__DIR__ . '/../resources/svg' => public_path('vendor/blade-elusive-icons'),
], 'blade-elusive-icons');

$this->publishes([
__DIR__.'/../config/blade-elusive-icons.php' => $this->app->configPath('blade-elusive-icons.php'),
__DIR__ . '/../config/blade-elusive-icons.php' => $this->app->configPath('blade-elusive-icons.php'),
], 'blade-elusive-icons-config');
}
}
Expand Down

0 comments on commit 7a83e15

Please sign in to comment.