-
-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (63 loc) · 2.59 KB
/
auto-update.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Auto Update Icons
on:
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 }}