Skip to content

Commit d040dac

Browse files
authored
✨ Add workflow for updating addon packages
1 parent 402e131 commit d040dac

File tree

1 file changed

+112
-0
lines changed

1 file changed

+112
-0
lines changed
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: Run Package updates
2+
3+
# yamllint disable-line rule:truthy
4+
on:
5+
workflow_call:
6+
secrets:
7+
token:
8+
required: true
9+
10+
concurrency:
11+
group: update-packages
12+
cancel-in-progress: false
13+
14+
jobs:
15+
information:
16+
name: ℹ️ Gather add-on information
17+
runs-on: ubuntu-latest
18+
outputs:
19+
addon-folder: ${{ steps.information.outputs.target }}
20+
os-architectures: ${{ steps.os-info.outputs.architectures }}
21+
os-version: ${{ steps.os-info.outputs.version }}
22+
steps:
23+
- name: ↩️ Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: ℹ️ Gather addon info
27+
id: information
28+
uses: frenck/action-addon-information@v1
29+
30+
- name: ℹ️ Determine OS information
31+
id: os-info
32+
shell: bash
33+
run: |
34+
first_build_image=$(yq e '.build_from | to_entries | .[0].value' ${{ steps.information.outputs.build-file }})
35+
36+
echo "build image for detection: $first_build_image"
37+
38+
is_alpine_image=$(echo $first_build_image | grep -q '/.*-base:' && echo "true" || echo "false")
39+
is_debian_image=$(echo $first_build_image | grep -q '/.*-base-debian:' && echo "true" || echo "false")
40+
41+
echo "alpine: $is_alpine_image | debian: $is_debian_image"
42+
43+
version_tag=$(echo $first_build_image | awk -F':' '{print $2}')
44+
45+
echo "os version: $version_tag"
46+
echo "version=${version_tag}" >> "$GITHUB_OUTPUT"
47+
48+
architectures=()
49+
50+
for arch in "${{ fromJson(steps.information.outputs.architectures) }}"; do
51+
if [[ "$is_alpine_image" = "true" ]]; then
52+
if [[ "$arch" = "amd64" ]]; then
53+
architectures+=("x86_64")
54+
elif [[ "$arch" = "i386" ]]; then
55+
architectures+=("x86")
56+
elif [[ "$arch" = "armhf" ]]; then
57+
architectures+=("armhf")
58+
elif [[ "$arch" = "armv7" ]]; then
59+
architectures+=("armv7")
60+
elif [[ "$arch" = "aarch64" ]]; then
61+
architectures+=("aarch64")
62+
fi
63+
64+
elif [[ "$is_debian_image" = "true" ]]; then
65+
if [[ "$arch" = "amd64" ]]; then
66+
architectures+=("amd64")
67+
elif [[ "$arch" = "i386" ]]; then
68+
architectures+=("i386")
69+
elif [[ "$arch" = "armhf" ]]; then
70+
architectures+=("armhf")
71+
elif [[ "$arch" = "armv7" ]]; then
72+
architectures+=("arm64")
73+
elif [[ "$arch" = "aarch64" ]]; then
74+
architectures+=("aarch64")
75+
fi
76+
77+
else
78+
echo "::error ::Could not determine os of build images"
79+
exit 1
80+
fi
81+
done
82+
83+
echo "os architectures: ${architectures[*]}"
84+
echo "architectures=${architectures[*]}" >> "$GITHUB_OUTPUT"
85+
86+
check-for-updates:
87+
name: Check for updates
88+
runs-on: ubuntu-latest
89+
needs:
90+
- information
91+
permissions:
92+
contents: write
93+
pull-requests: write
94+
steps:
95+
- name: ↩️ Checkout
96+
uses: actions/checkout@v4
97+
with:
98+
fetch-depth: 0
99+
100+
- name: 🔧 Set git bot user
101+
shell: bash
102+
run: |
103+
git config user.name github-actions
104+
git config user.email [email protected]
105+
106+
- name: 🚀 Run Updater
107+
uses: Poeschl/container-package-updater@v3
108+
with:
109+
token: ${{ secrets.TOKEN }}
110+
containerFile: ${{ needs.information.outputs.addon-folder }}/Dockerfile
111+
osVersion: ${{ needs.information.outputs.os-version }}
112+
architectures: $ {{ needs.information.outputs.os-architectures }}

0 commit comments

Comments
 (0)