Skip to content

Commit 7981d93

Browse files
authored
Add release-suffixed tags to Docker images for version pinning (#326)
Adds additional Docker image tags suffixed with the GitHub release version alongside standard tags. This gives downstream projects better control over version pinning and the ability to target specific releases of base images. For example, on release 2025.11.0, these tags will be published: - amd64-base:3.21 AND amd64-base:3.21-2025.11.0 - amd64-base-python:3.13-alpine3.21 AND amd64-base-python:3.13-alpine3.21-2025.11.0
1 parent aeb7e1c commit 7981d93

File tree

1 file changed

+45
-20
lines changed

1 file changed

+45
-20
lines changed

.github/workflows/builder.yml

Lines changed: 45 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,17 @@ jobs:
8989
- name: Set build arguments
9090
shell: bash
9191
run: |
92-
if [[ "${{ github.event_name }}" != "release" ]]; then
93-
echo "BUILD_ARGS=--test" >> $GITHUB_ENV
94-
elif [[ "${{ env.ALPINE_LATEST }}" != "${{ matrix.version }}" ]]; then
95-
echo "BUILD_ARGS=--no-latest" >> $GITHUB_ENV
92+
if [[ "${{ github.event_name }}" == "release" ]]; then
93+
BUILD_ARGS="--additional-tag ${{ matrix.version }}-${{ github.event.release.tag_name }}"
94+
if [[ "${{ env.ALPINE_LATEST }}" != "${{ matrix.version }}" ]]; then
95+
BUILD_ARGS="$BUILD_ARGS --no-latest"
96+
fi
97+
else
98+
BUILD_ARGS="--test"
9699
fi
97100
101+
echo "BUILD_ARGS=$BUILD_ARGS" >> $GITHUB_ENV
102+
98103
- name: Build base image
99104
uses: home-assistant/builder@2025.09.0
100105
with:
@@ -122,12 +127,17 @@ jobs:
122127
- name: Set build arguments
123128
shell: bash
124129
run: |
125-
if [[ "${{ github.event_name }}" != "release" ]]; then
126-
echo "BUILD_ARGS=--test" >> $GITHUB_ENV
127-
elif [[ "${{ env.DEBIAN_LATEST }}" != "${{ matrix.version }}" ]]; then
128-
echo "BUILD_ARGS=--no-latest" >> $GITHUB_ENV
130+
if [[ "${{ github.event_name }}" == "release" ]]; then
131+
BUILD_ARGS="--additional-tag ${{ matrix.version }}-${{ github.event.release.tag_name }}"
132+
if [[ "${{ env.DEBIAN_LATEST }}" != "${{ matrix.version }}" ]]; then
133+
BUILD_ARGS="$BUILD_ARGS --no-latest"
134+
fi
135+
else
136+
BUILD_ARGS="--test"
129137
fi
130138
139+
echo "BUILD_ARGS=$BUILD_ARGS" >> $GITHUB_ENV
140+
131141
- name: Build base image
132142
uses: home-assistant/builder@2025.09.0
133143
with:
@@ -156,12 +166,17 @@ jobs:
156166
- name: Set build arguments
157167
shell: bash
158168
run: |
159-
if [[ "${{ github.event_name }}" != "release" ]]; then
160-
echo "BUILD_ARGS=--test" >> $GITHUB_ENV
161-
elif [[ "${{ env.UBUNTU_LATEST }}" != "${{ matrix.version }}" ]]; then
162-
echo "BUILD_ARGS=--no-latest" >> $GITHUB_ENV
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"
163176
fi
164177
178+
echo "BUILD_ARGS=$BUILD_ARGS" >> $GITHUB_ENV
179+
165180
- name: Build base image
166181
uses: home-assistant/builder@2025.09.0
167182
with:
@@ -189,12 +204,17 @@ jobs:
189204
- name: Set build arguments
190205
shell: bash
191206
run: |
192-
if [[ "${{ github.event_name }}" != "release" ]]; then
193-
echo "BUILD_ARGS=--test" >> $GITHUB_ENV
194-
elif [[ "${{ env.RASPBIAN_LATEST }}" != "${{ matrix.version }}" ]]; then
195-
echo "BUILD_ARGS=--no-latest" >> $GITHUB_ENV
207+
if [[ "${{ github.event_name }}" == "release" ]]; then
208+
BUILD_ARGS="--additional-tag ${{ matrix.version }}-${{ github.event.release.tag_name }}"
209+
if [[ "${{ env.RASPBIAN_LATEST }}" != "${{ matrix.version }}" ]]; then
210+
BUILD_ARGS="$BUILD_ARGS --no-latest"
211+
fi
212+
else
213+
BUILD_ARGS="--test"
196214
fi
197215
216+
echo "BUILD_ARGS=$BUILD_ARGS" >> $GITHUB_ENV
217+
198218
- name: Build base image
199219
uses: home-assistant/builder@2025.09.0
200220
with:
@@ -232,12 +252,17 @@ jobs:
232252
- name: Set build arguments
233253
shell: bash
234254
run: |
235-
if [[ "${{ github.event_name }}" != "release" ]]; then
236-
echo "BUILD_ARGS=--test" >> $GITHUB_ENV
237-
elif [[ "${{ env.ALPINE_LATEST }}" != "${{ matrix.version }}" ]] || [[ "${{ env.PYTHON_LATEST }}" != "${{ matrix.python }}" ]]; then
238-
echo "BUILD_ARGS=--no-latest" >> $GITHUB_ENV
255+
if [[ "${{ github.event_name }}" == "release" ]]; then
256+
BUILD_ARGS="--additional-tag ${{ matrix.python }}-alpine${{ matrix.version }}-${{ github.event.release.tag_name }}"
257+
if [[ "${{ env.ALPINE_LATEST }}" != "${{ matrix.version }}" ]] || [[ "${{ env.PYTHON_LATEST }}" != "${{ matrix.python }}" ]]; then
258+
BUILD_ARGS="$BUILD_ARGS --no-latest"
259+
fi
260+
else
261+
BUILD_ARGS="--test"
239262
fi
240263
264+
echo "BUILD_ARGS=$BUILD_ARGS" >> $GITHUB_ENV
265+
241266
- name: Build base image
242267
uses: home-assistant/builder@2025.09.0
243268
with:

0 commit comments

Comments
 (0)