From 9d35d283a5f95e4715ebd3187c0eac28a779aa68 Mon Sep 17 00:00:00 2001 From: Swapnil Sarwe Date: Sat, 18 Feb 2023 18:59:05 +0530 Subject: [PATCH 1/2] laravel 10 support --- .github/workflows/auto-update.yml | 82 +++++++++++++++++++++++++ .github/workflows/php-cs-fixer.yml | 40 ++++++++++++ .github/workflows/tests.yml | 13 +++- .github/workflows/update-changelog.yaml | 3 +- composer.json | 5 +- 5 files changed, 137 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/auto-update.yml create mode 100644 .github/workflows/php-cs-fixer.yml diff --git a/.github/workflows/auto-update.yml b/.github/workflows/auto-update.yml new file mode 100644 index 0000000..65934b2 --- /dev/null +++ b/.github/workflows/auto-update.yml @@ -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<> $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 + 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 }} + diff --git a/.github/workflows/php-cs-fixer.yml b/.github/workflows/php-cs-fixer.yml new file mode 100644 index 0000000..22b293b --- /dev/null +++ b/.github/workflows/php-cs-fixer.yml @@ -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 + diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9fc21aa..1a217e6 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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 @@ -38,3 +44,4 @@ jobs: - name: Execute tests run: vendor/bin/phpunit --verbose + diff --git a/.github/workflows/update-changelog.yaml b/.github/workflows/update-changelog.yaml index fa56639..51005af 100644 --- a/.github/workflows/update-changelog.yaml +++ b/.github/workflows/update-changelog.yaml @@ -10,7 +10,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: ref: main @@ -26,3 +26,4 @@ jobs: branch: main commit_message: Update CHANGELOG file_pattern: CHANGELOG.md + diff --git a/composer.json b/composer.json index f8317a7..b8d3421 100644 --- a/composer.json +++ b/composer.json @@ -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": { From bee1a72e7fb4cf78956f172c24caa4e05a5ff287 Mon Sep 17 00:00:00 2001 From: swapnilsarwe Date: Sat, 18 Feb 2023 13:29:45 +0000 Subject: [PATCH 2/2] Fix styling --- src/BladeElusiveIconsServiceProvider.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/BladeElusiveIconsServiceProvider.php b/src/BladeElusiveIconsServiceProvider.php index 48989a6..0777fbf 100644 --- a/src/BladeElusiveIconsServiceProvider.php +++ b/src/BladeElusiveIconsServiceProvider.php @@ -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 { @@ -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'); } }