forked from home-assistant/version
-
Notifications
You must be signed in to change notification settings - Fork 0
114 lines (102 loc) · 3.57 KB
/
jh-check-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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: JH upstream modules version check
on:
workflow_dispatch:
inputs:
files:
description: 'File(s) to run action against'
required: true
push:
branches: ["master"]
paths:
- apparmor.txt
- '*.json'
- rpi-imager-haos.png
- homeassistant.pub
schedule:
- cron: '0 2 * * *'
jobs:
prepare:
name: Prepare
runs-on: [ self-hosted ]
if: ${{ github.repository_owner == 'jethub-homeassistant' }}
outputs:
files: ${{ steps.changed_files.outputs.files }}
steps:
- name: Checkout the repository
uses: actions/checkout@v3
- name: Get changed files for push
if: github.event_name == 'push'
id: changed_files_push
uses: jitterbit/get-changed-files@v1
- name: Get changed files
id: changed_files
run: |
if [[ ${{ github.event_name }} == "push" ]]; then
echo "files=${{ steps.changed_files_push.outputs.all }}" >> $GITHUB_OUTPUT
else
#echo "files=${{ github.event.inputs.files }}" >> $GITHUB_OUTPUT
echo "files=beta.json dev.json stable.json" >> $GITHUB_OUTPUT
fi
updatever:
name: Prepare repository
needs: ["prepare"]
runs-on: [self-hosted]
if: ${{ github.repository_owner == 'jethub-homeassistant' }}
steps:
- name: Checkout jethub version repository (master)
uses: actions/checkout@v3
with:
fetch-depth: 0
repository: jethub-homeassistant/version
path: version
token: ${{ secrets.GITHUB_TOKEN }}
ref: master-jethub
- name: Checkout jethub upstream version repository (master)
if: github.event_name != 'push'
uses: actions/checkout@v3
with:
fetch-depth: 1
repository: jethub-homeassistant/version
path: version-upstream
token: ${{ secrets.GITHUB_TOKEN }}
ref: master
- name: Checkout home-assistant version repository (master)
if: github.event_name != 'push'
uses: actions/checkout@v3
with:
fetch-depth: 1
repository: home-assistant/version
path: version-upstream
token: ${{ secrets.GITHUB_TOKEN }}
ref: master
- name: Compare
run: |
cd version
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "GitHub Actions"
for channel in stable beta dev; do
# check supervisor version
# check homeassistant version
# check hassos version
# hassos-upgrade
# ota, image, images - not modifyed
if [[ "${{ needs.prepare.outputs.files }}" =~ $channel.json ]]; then
echo "Update $channel.json with:"
cat ../version-upstream/$channel.json | jq '{cli,dns,audio,multicast,observer}' > ${channel}-up.json
cat ${channel}-up.json
jq '. + input' $channel.json ${channel}-up.json > ${channel}-new.json
rm -f $channel.json ${channel}-up.json
mv ${channel}-new.json $channel.json
git add $channel.json
fi
done;
git commit -m "Sync versions with upstream" || true
cd ..
- name: Push changes ${{ matrix.repo.branch }}
uses: ad-m/github-push-action@master
with:
directory: version
repository: jethub-homeassistant/version
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: master-jethub
force_with_lease: false