Merge pull request #2 from codeat3/develop #5
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: Auto Update Icons | |
on: | |
push: | |
schedule: | |
- cron: '0 12 * * 1' | |
jobs: | |
generate: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
php: [8.3] | |
laravel: [^11.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: 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 }} |