Skip to content

Commit

Permalink
ci(home-assistant): updater action
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabor Pichner committed Jan 7, 2024
1 parent ac13318 commit ade71e1
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 2 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/ha-updater.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Update Home Assistant appVersion

on:
workflow_dispatch:
schedule:
- cron: '0 8 * * *'

jobs:
update-version:
runs-on: ubuntu-22.04

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Get stable digest
id: get-stable-digest
run: |
stable_digest=$(curl -s "https://registry.hub.docker.com/v2/repositories/homeassistant/home-assistant/tags/stable" | jq -r .digest)
echo "Stable digest: $stable_digest"
echo "::set-output name=stable_digest::$stable_digest"
- name: Get app versions
id: get-image-tag
run: |
tag=$(curl -s "https://registry.hub.docker.com/v2/repositories/homeassistant/home-assistant/tags?page_size=100" | \
jq -r --arg stable_digest "${{ steps.get-stable-digest.outputs.stable_digest }}" '.results | map(select(.digest == $stable_digest) | .name) | map(select(test("^[0-9]{4}\\.[0-9]{1,2}\\.[0-9]+$"))) | .[]')
echo "App stable tag: $tag"
echo "::set-output name=tag::$tag"
- name: Update Chart.yaml
run: |
src_file="charts/home-assistant/Chart.yaml"
app_version="$(yq '.appVersion' $src_file)"
image_tag="${{ steps.get-image-tag.outputs.tag }}"
echo "Updating Chart.yaml with appVersion: $image_tag"
diff -B <(yq "$src_file") <(yq eval ".appVersion = \"$image_tag\"" "$src_file") | patch "$src_file"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
title: 'bump(home-assistant): update app version'
body: 'Automatically updated Home Assistant app versions'
commit-message: 'bump(home-assistant): appVersion "${{ steps.get-image-tag.outputs.tag }}'
branch-suffix: timestamp
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
packages: write # needed for ghcr access
id-token: write # needed for keyless signing

runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Checkout Code
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sync-readme.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
permissions:
contents: write # for git push

runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- run: |
Expand Down

0 comments on commit ade71e1

Please sign in to comment.