Skip to content

Commit 68d8b07

Browse files
authored
Merge branch 'stable' into release-3.3.1
2 parents 01fb36e + 9b99c09 commit 68d8b07

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Unity Version Badge
2+
3+
on:
4+
push:
5+
paths:
6+
- 'ProjectSettings/ProjectVersion.txt'
7+
workflow_dispatch:
8+
9+
jobs:
10+
update-badge:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v2
15+
16+
- name: Read Unity Version
17+
id: read_unity_version
18+
run: |
19+
unity_version=$(grep -oP 'm_EditorVersion: \K.*' ProjectSettings/ProjectVersion.txt)
20+
echo "UNITY_VERSION=$unity_version" >> $GITHUB_ENV
21+
22+
- name: Update README with Badge
23+
run: |
24+
badge_url="https://img.shields.io/badge/Unity-$UNITY_VERSION-brightgreen"
25+
sed -i 's|!\[Unity\](.*)|![Unity]('"$badge_url"')|' README.md
26+
sed -i 's|!\[Unity\](.*)|![Unity]('"$badge_url"')|' etc/PackageTemplate/README.md
27+
28+
- name: Commit changes
29+
run: |
30+
git config --global user.name 'github-actions'
31+
git config --global user.email '[email protected]'
32+
git add README.md
33+
git add etc/PackageTemplate/README.md
34+
git commit -m "Update Unity version badge to $UNITY_VERSION"
35+
git push

0 commit comments

Comments
 (0)