diff --git a/.github/workflows/update-badge.yml b/.github/workflows/update-badge.yml new file mode 100644 index 00000000..8fcab4d9 --- /dev/null +++ b/.github/workflows/update-badge.yml @@ -0,0 +1,42 @@ +name: Update HA Version Badge + +on: + push: + branches: [ "master" ] # If your default branch is "master", change this + schedule: + - cron: '0 0 * * *' # Runs daily at midnight UTC + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Check out repository + uses: actions/checkout@v2 + + - name: Set up Node + uses: actions/setup-node@v2 + with: + node-version: 16 + + - name: Install Badgen + run: npm install -g badgen-cli + + - name: Generate Badge + id: gen_badge + run: | + HA_VERSION=$(cat config/.HA_VERSION) + badgen --label "HA Version" --status "$HA_VERSION" --color "blue" > ha-version-badge.svg + echo "::set-output name=haVersion::$HA_VERSION" + + + - name: Commit and Push changes + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + git add ha-version-badge.svg + # Only commit if there's a change + git diff --quiet --cached || git commit -m "Update HA version badge to ${{ steps.gen_badge.outputs.haVersion }}" + git push diff --git a/README.md b/README.md index 8e293742..f6066946 100755 --- a/README.md +++ b/README.md @@ -9,7 +9,8 @@ [![X Follow](https://img.shields.io/twitter/follow/ccostan?color=blue&label=talk&logo=twitter&style=for-the-badge)](https://x.com/ccostan) [![YouTube Subscribe](https://img.shields.io/youtube/channel/subscribers/UC301G8JJFzY0BZ_0lshpKpQ?label=VIEW&logo=Youtube&logoColor=%23DF5D44&style=for-the-badge)](https://www.youtube.com/vCloudInfo?sub_confirmation=1) -[![GitHub Follow](https://img.shields.io/github/stars/CCOSTAN/Home-AssistantConfig?label=sTARS&logo=Github&style=for-the-badge)](https://github.com/CCOSTAN) +[![GitHub Follow](https://img.shields.io/github/stars/CCOSTAN/Home-AssistantConfig?label=sTARS&logo=Github&style=for-the-badge)](https://github.com/CCOSTAN)
+[![HA Version Badge](https://raw.githubusercontent.com/ccostan/home-assistantconfig/master/ha-version-badge.svg)](https://github.com/CCOSTAN/Home-AssistantConfig/blob/master/config/.HA_VERSION)

diff --git a/ha-version-badge.svg b/ha-version-badge.svg new file mode 100644 index 00000000..ca00f6fa --- /dev/null +++ b/ha-version-badge.svg @@ -0,0 +1,16 @@ + + 2024.12.4 + + + + + + + + + + +