Skip to content

Commit ba20a9f

Browse files
committed
ci: Add fetch-icons script to automatically deploy icon changes
1 parent 422cb9a commit ba20a9f

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

.github/workflows/fetch-icons.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Fetch Icons
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
changelog:
7+
description: "Changelog for the icons update"
8+
required: true
9+
type: string
10+
version:
11+
description: "Version number for the icons update"
12+
required: true
13+
type: string
14+
15+
permissions:
16+
contents: write
17+
pull-requests: write
18+
19+
jobs:
20+
fetch-icons:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout zeta_flutter
24+
uses: actions/checkout@v4
25+
with:
26+
path: flutter
27+
ref: main
28+
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
29+
30+
- name: Checkout zeta-icons
31+
uses: actions/checkout@v4
32+
with:
33+
path: icons
34+
ref: main
35+
repository: ZebraDevs/zeta-icons
36+
37+
- name: Copy updated icons
38+
run: |
39+
cp -r icons/outputs/flutter/. flutter/packages/zeta_icons/lib/src
40+
41+
- name: Set pubspec version
42+
run: |
43+
cd flutter/packages/zeta_icons/
44+
sed -i 's/^version: .*/version: ${{ github.event.inputs.version }}/' pubspec.yaml
45+
46+
- name: Push changes
47+
run: |
48+
cd flutter
49+
git config --global user.name "zeta-icons-bot"
50+
git config --global user.email "[email protected]"
51+
git add packages/zeta_icons/
52+
git commit -m "chore: release zeta_icons v${{ github.event.inputs.version }}" -m "${{ github.event.inputs.changelog }}"
53+
git tag -f zeta_icons-v${{ github.event.inputs.version }} -m "${{ github.event.inputs.changelog }}"
54+
git push origin main --force-with-lease
55+
git push --tags
56+
57+
- uses: actions/github-script@v7
58+
name: Create release
59+
with:
60+
script: |
61+
github.rest.repos.createRelease({
62+
owner: context.repo.owner,
63+
repo: context.repo.repo,
64+
tag_name: `zeta_icons-v${{ github.event.inputs.version }}`,
65+
body: `${{ github.event.inputs.changelog }}`
66+
})

0 commit comments

Comments
 (0)