|
16 | 16 | jobs: |
17 | 17 | init: |
18 | 18 | name: Initialize build |
19 | | - runs-on: &runs-on-ubuntu ubuntu-24.04 |
| 19 | + runs-on: ubuntu-latest |
20 | 20 | outputs: |
21 | 21 | architectures_alpine: ${{ steps.info_alpine.outputs.architectures }} |
22 | 22 | architectures_debian: ${{ steps.info_debian.outputs.architectures }} |
23 | 23 | architectures_ubuntu: ${{ steps.info_ubuntu.outputs.architectures }} |
24 | 24 | release: ${{ steps.version.outputs.version }} |
| 25 | + alpine_latest: ${{ steps.set-latest.outputs.alpine_latest}} |
| 26 | + debian_latest: ${{ steps.set-latest.outputs.debian_latest}} |
| 27 | + ubuntu_latest: ${{ steps.set-latest.outputs.ubuntu_latest}} |
| 28 | + python_latest: ${{ steps.set-latest.outputs.python_latest}} |
25 | 29 | steps: |
26 | 30 | - name: Checkout the repository |
27 | 31 | |
@@ -52,183 +56,74 @@ jobs: |
52 | 56 | with: |
53 | 57 | type: ${{ env.BUILD_TYPE }} |
54 | 58 |
|
| 59 | + - name: Set latest tags |
| 60 | + id: set-latest |
| 61 | + run: | |
| 62 | + echo "alpine_latest=${{ env.ALPINE_LATEST }}" >> $GITHUB_ENV |
| 63 | + echo "debian_latest=${{ env.DEBIAN_LATEST }}" >> $GITHUB_ENV |
| 64 | + echo "ubuntu_latest=${{ env.UBUNTU_LATEST }}" >> $GITHUB_ENV |
| 65 | + echo "python_latest=${{ env.PYTHON_LATEST }}" >> $GITHUB_ENV |
| 66 | +
|
55 | 67 | build_alpine: |
56 | | - name: Build ${{ matrix.arch }} alpine ${{ matrix.version }} base image |
| 68 | + name: Alpine ${{ matrix.version }} |
57 | 69 | needs: init |
58 | | - runs-on: ${{ matrix.os }} |
59 | | - permissions: &permissions |
60 | | - contents: read |
61 | | - id-token: write |
62 | | - packages: write |
63 | 70 | strategy: |
64 | 71 | matrix: |
65 | | - arch: ${{ fromJson(needs.init.outputs.architectures_alpine) }} |
66 | 72 | version: ["3.20", "3.21", "3.22"] |
67 | | - include: &matrix-include-build |
68 | | - - os: *runs-on-ubuntu |
69 | | - - arch: aarch64 |
70 | | - os: ubuntu-24.04-arm |
71 | | - steps: |
72 | | - - &checkout |
73 | | - name: Checkout the repository |
74 | | - |
75 | | - |
76 | | - - &login-container-registry |
77 | | - name: Login to GitHub Container Registry |
78 | | - if: github.event_name == 'release' |
79 | | - uses: docker/login-action@v3 |
80 | | - with: |
81 | | - registry: ghcr.io |
82 | | - username: ${{ github.repository_owner }} |
83 | | - password: ${{ secrets.GITHUB_TOKEN }} |
84 | | - |
85 | | - - name: Set build arguments |
86 | | - shell: bash |
87 | | - run: | |
88 | | - if [[ "${{ github.event_name }}" == "release" ]]; then |
89 | | - BUILD_ARGS="--additional-tag ${{ matrix.version }}-${{ github.event.release.tag_name }}" |
90 | | - if [[ "${{ env.ALPINE_LATEST }}" != "${{ matrix.version }}" ]]; then |
91 | | - BUILD_ARGS="$BUILD_ARGS --no-latest" |
92 | | - fi |
93 | | - else |
94 | | - BUILD_ARGS="--test" |
95 | | - fi |
96 | | -
|
97 | | - echo "BUILD_ARGS=$BUILD_ARGS" >> $GITHUB_ENV |
98 | | -
|
99 | | - - name: Build base image |
100 | | - uses: home-assistant/[email protected] |
101 | | - with: |
102 | | - image: ${{ matrix.arch }} |
103 | | - args: | |
104 | | - $BUILD_ARGS \ |
105 | | - --${{ matrix.arch }} \ |
106 | | - --target /data/alpine \ |
107 | | - --cosign \ |
108 | | - --release ${{ needs.init.outputs.release }} \ |
109 | | - --base ${{ matrix.version }} |
| 73 | + uses: ./.github/workflows/reuseable-builder.yml |
| 74 | + with: |
| 75 | + target: alpine |
| 76 | + architectures: ${{ needs.init.outputs.architectures_alpine }} |
| 77 | + version: ${{ matrix.version }} |
| 78 | + release_name: ${{ needs.init.outputs.release }} |
| 79 | + tag_latest: ${{ needs.init.outputs.alpine_latest }} |
110 | 80 |
|
111 | 81 | build_debian: |
112 | | - name: Build ${{ matrix.arch }} debian ${{ matrix.version }} base image |
| 82 | + name: Debian ${{ matrix.version }} |
113 | 83 | needs: init |
114 | | - runs-on: ${{ matrix.os }} |
115 | | - permissions: *permissions |
116 | 84 | strategy: |
| 85 | + fail-fast: false |
117 | 86 | matrix: |
118 | | - arch: ${{ fromJson(needs.init.outputs.architectures_debian) }} |
119 | 87 | version: ["bookworm", "trixie"] |
120 | | - include: *matrix-include-build |
121 | | - steps: |
122 | | - - *checkout |
123 | | - - *login-container-registry |
124 | | - |
125 | | - - name: Set build arguments |
126 | | - shell: bash |
127 | | - run: | |
128 | | - if [[ "${{ github.event_name }}" == "release" ]]; then |
129 | | - BUILD_ARGS="--additional-tag ${{ matrix.version }}-${{ github.event.release.tag_name }}" |
130 | | - if [[ "${{ env.DEBIAN_LATEST }}" != "${{ matrix.version }}" ]]; then |
131 | | - BUILD_ARGS="$BUILD_ARGS --no-latest" |
132 | | - fi |
133 | | - else |
134 | | - BUILD_ARGS="--test" |
135 | | - fi |
136 | | -
|
137 | | - echo "BUILD_ARGS=$BUILD_ARGS" >> $GITHUB_ENV |
138 | | -
|
139 | | - - name: Build base image |
140 | | - uses: home-assistant/[email protected] |
141 | | - with: |
142 | | - image: ${{ matrix.arch }} |
143 | | - args: | |
144 | | - $BUILD_ARGS \ |
145 | | - --${{ matrix.arch }} \ |
146 | | - --target /data/debian \ |
147 | | - --cosign \ |
148 | | - --release ${{ needs.init.outputs.release }} \ |
149 | | - --version-from ${{ matrix.version }}-slim \ |
150 | | - --base ${{ matrix.version }} |
| 88 | + uses: ./.github/workflows/reuseable-builder.yml |
| 89 | + with: |
| 90 | + target: debian |
| 91 | + architectures: ${{ needs.init.outputs.architectures_debian }} |
| 92 | + version: ${{ matrix.version }} |
| 93 | + release_name: ${{ needs.init.outputs.release }} |
| 94 | + version_from: ${{ matrix.version }}-slim |
| 95 | + tag_latest: ${{ needs.init.outputs.debian_latest }} |
151 | 96 |
|
152 | 97 | build_ubuntu: |
153 | | - name: Build ${{ matrix.arch }} ubuntu ${{ matrix.version }} base image |
| 98 | + name: Ubuntu ${{ matrix.version }} |
154 | 99 | needs: init |
155 | | - runs-on: ${{ matrix.os }} |
156 | | - permissions: *permissions |
157 | 100 | strategy: |
| 101 | + fail-fast: false |
158 | 102 | matrix: |
159 | | - arch: ${{ fromJson(needs.init.outputs.architectures_ubuntu) }} |
160 | 103 | version: ["16.04", "18.04", "20.04", "22.04", "24.04"] |
161 | | - include: *matrix-include-build |
162 | | - steps: |
163 | | - - *checkout |
164 | | - - *login-container-registry |
165 | | - |
166 | | - - name: Set build arguments |
167 | | - shell: bash |
168 | | - run: | |
169 | | - if [[ "${{ github.event_name }}" == "release" ]]; then |
170 | | - BUILD_ARGS="--additional-tag ${{ matrix.version }}-${{ github.event.release.tag_name }}" |
171 | | - if [[ "${{ env.UBUNTU_LATEST }}" != "${{ matrix.version }}" ]]; then |
172 | | - BUILD_ARGS="$BUILD_ARGS --no-latest" |
173 | | - fi |
174 | | - else |
175 | | - BUILD_ARGS="--test" |
176 | | - fi |
177 | | -
|
178 | | - echo "BUILD_ARGS=$BUILD_ARGS" >> $GITHUB_ENV |
179 | | -
|
180 | | - - name: Build base image |
181 | | - uses: home-assistant/[email protected] |
182 | | - with: |
183 | | - image: ${{ matrix.arch }} |
184 | | - args: | |
185 | | - $BUILD_ARGS \ |
186 | | - --${{ matrix.arch }} \ |
187 | | - --target /data/ubuntu \ |
188 | | - --cosign \ |
189 | | - --release ${{ needs.init.outputs.release }} \ |
190 | | - --base ${{ matrix.version }} |
| 104 | + uses: ./.github/workflows/reuseable-builder.yml |
| 105 | + with: |
| 106 | + target: ubuntu |
| 107 | + architectures: ${{ needs.init.outputs.architectures_ubuntu }} |
| 108 | + version: ${{ matrix.version }} |
| 109 | + release_name: ${{ needs.init.outputs.release }} |
| 110 | + tag_latest: ${{ needs.init.outputs.ubuntu_latest }} |
191 | 111 |
|
192 | 112 | build_python: |
193 | | - name: Build ${{ matrix.arch }} alpine ${{ matrix.version }} - python ${{ matrix.python }} base image |
| 113 | + name: Alpine ${{ matrix.version }} - python ${{ matrix.python }} |
194 | 114 | needs: [init, build_alpine] |
195 | | - runs-on: ${{ matrix.os }} |
196 | | - permissions: *permissions |
197 | 115 | strategy: |
198 | 116 | fail-fast: false |
199 | 117 | matrix: |
200 | | - arch: ${{ fromJson(needs.init.outputs.architectures_alpine) }} |
201 | 118 | version: ["3.20", "3.21", "3.22"] |
202 | 119 | python: ["3.12", "3.13", "3.14"] |
203 | | - include: *matrix-include-build |
204 | | - steps: |
205 | | - - *checkout |
206 | | - - *login-container-registry |
207 | | - |
208 | | - - name: Set build arguments |
209 | | - shell: bash |
210 | | - run: | |
211 | | - if [[ "${{ github.event_name }}" == "release" ]]; then |
212 | | - BUILD_ARGS="--additional-tag ${{ matrix.python }}-alpine${{ matrix.version }}-${{ github.event.release.tag_name }}" |
213 | | - if [[ "${{ env.ALPINE_LATEST }}" != "${{ matrix.version }}" ]] || [[ "${{ env.PYTHON_LATEST }}" != "${{ matrix.python }}" ]]; then |
214 | | - BUILD_ARGS="$BUILD_ARGS --no-latest" |
215 | | - fi |
216 | | - else |
217 | | - BUILD_ARGS="--test" |
218 | | - fi |
219 | | -
|
220 | | - echo "BUILD_ARGS=$BUILD_ARGS" >> $GITHUB_ENV |
221 | | -
|
222 | | - - name: Build base image |
223 | | - uses: home-assistant/[email protected] |
224 | | - with: |
225 | | - image: ${{ matrix.arch }} |
226 | | - args: | |
227 | | - $BUILD_ARGS \ |
228 | | - --${{ matrix.arch }} \ |
229 | | - --target "/data/python/${{ matrix.python }}" \ |
230 | | - --cosign \ |
231 | | - --release ${{ needs.init.outputs.release }} \ |
232 | | - --version-from ${{ matrix.version }} \ |
233 | | - --version ${{ matrix.python }} \ |
234 | | - --base ${{ matrix.python }}-alpine${{ matrix.version }} |
| 120 | + uses: ./.github/workflows/reuseable-builder.yml |
| 121 | + with: |
| 122 | + target: python/${{ matrix.python }} |
| 123 | + architectures: ${{ needs.init.outputs.architectures_alpine }} |
| 124 | + version: ${{ matrix.version }} |
| 125 | + python: ${{ matrix.python }} |
| 126 | + release_name: ${{ needs.init.outputs.release }} |
| 127 | + version_from: ${{ matrix.version }} |
| 128 | + tag_latest: ${{ needs.init.outputs.alpine_latest }} |
| 129 | + python_latest: ${{ needs.init.outputs.python_latest }} |
0 commit comments