-
-
Notifications
You must be signed in to change notification settings - Fork 1
87 lines (70 loc) · 3.23 KB
/
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
78
79
80
81
82
83
84
85
86
87
name: Update
on:
schedule:
- cron: "0 12 * * *"
workflow_dispatch:
env:
repository: iconoir-icons/iconoir
jobs:
update:
name: Update icons
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- id: current-version
name: Get current version
uses: juliangruber/read-file-action@v1
with:
path: ./.version
trim: true
- id: latest-version
name: Get latest version
uses: pozetroninc/[email protected]
with:
repository: ${{ env.repository }}
token: ${{ secrets.GITHUB_TOKEN }}
- id: new-version
name: Compare versions
run: |
echo "Current version: ${{ steps.current-version.outputs.content }}"
echo "Latest version: ${{ steps.latest-version.outputs.release }}"
if [ "${{ steps.current-version.outputs.content }}" != "${{ steps.latest-version.outputs.release }}" ]; then
echo ::set-output name=exists::true
fi
- name: Download iconoir
if: steps.new-version.outputs.exists
run: |
# Download the latest version of iconoir
curl -sSL https://github.com/${{ env.repository }}/archive/refs/tags/${{ steps.latest-version.outputs.release }}.tar.gz -o iconoir.tar.gz
# Remove existing icons
rm -rf resources/svg/*
# Extract the new icon directories in resources/svg
tar -C resources/svg \
--wildcards \
--strip-components=2 \
-zxf iconoir.tar.gz \
'iconoir-*/icons/**/*.svg'
# Move the regular icons to resources/svg
mv -v resources/svg/regular/*.svg resources/svg
# Add the "-solid" suffix to the solid icons and move them to resources/svg
for file in resources/svg/solid/*.svg; do
mv -v "$file" "resources/svg/$(basename "$file" .svg)-solid.svg"
done
# Clean up
rm iconoir.tar.gz
rmdir resources/svg/regular
rmdir resources/svg/solid
- name: Update .version
if: steps.new-version.outputs.exists
run: echo ${{ steps.latest-version.outputs.release }} > ./.version
- name: Create pull request
if: steps.new-version.outputs.exists
uses: peter-evans/create-pull-request@v7
with:
commit-message: "chore: update to iconoir ${{ steps.latest-version.outputs.release }}"
title: "chore: update to iconoir ${{ steps.latest-version.outputs.release }}"
branch: chore/update-${{ steps.latest-version.outputs.release }}
body: |
This PR updates iconoir from [${{ steps.current-version.outputs.content }}](https://github.com/${{ env.repository }}/releases/tag/${{ steps.current-version.outputs.content }}) to [${{ steps.latest-version.outputs.release }}](https://github.com/${{ env.repository }}/releases/tag/${{ steps.latest-version.outputs.release }}).
Check out the differences: [`${{ steps.current-version.outputs.content }}` ... `${{ steps.latest-version.outputs.release }}`](https://github.com/${{ env.repository }}/compare/${{ steps.current-version.outputs.content }}...${{ steps.latest-version.outputs.release }})