Auto Update Icons #138
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: | |
schedule: | |
- cron: '0 12 * * 1' | |
jobs: | |
generate: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
php: [8.2] | |
laravel: [^8.2] | |
name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.head_ref }} | |
- name: Checkout dependent repo | |
run: | | |
mkdir dist && ./bin/compile.sh | |
- id: latest-commit | |
name: Get the latest commit | |
run: | | |
echo 'LATEST_COMMIT<<EOF' >> $GITHUB_ENV | |
cd ./dist && date +"%Y-%m-%d-%H-%M" >> $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 <noreply@github.com> | |
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 }} |