From b6a7462368871566586dd625f4179310e44afbe4 Mon Sep 17 00:00:00 2001 From: puddly <32534428+puddly@users.noreply.github.com> Date: Sun, 15 Nov 2026 15:57:25 +0000 Subject: [PATCH 1/2] Skip publishing if the version is already published --- .github/workflows/build-app.yaml | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-app.yaml b/.github/workflows/build-app.yaml index db4f157..2efc554 100644 --- a/.github/workflows/build-app.yaml +++ b/.github/workflows/build-app.yaml @@ -24,6 +24,7 @@ jobs: url: ${{ steps.normalize.outputs.url }} registry_prefix: ${{ steps.normalize.outputs.registry_prefix }} version: ${{ steps.normalize.outputs.version }} + publish: ${{ steps.published.outputs.publish }} steps: - name: Check out the repository uses: actions/checkout@v6.0.3 @@ -51,6 +52,23 @@ jobs: echo "url=${url}" >> "$GITHUB_OUTPUT" fi + - name: Skip publishing if the version is already published + id: published + env: + IMAGE: ${{ steps.info.outputs.image }} + VERSION: ${{ steps.normalize.outputs.version }} + PUBLISH: ${{ inputs.publish }} + run: | + if output=$(docker buildx imagetools inspect "${IMAGE}:${VERSION}" 2>&1); then + echo "::notice::${IMAGE}:${VERSION} already exists, it will not be overwritten" + echo "publish=false" >> "$GITHUB_OUTPUT" + elif [[ "${output}" == *"not found"* ]]; then + echo "publish=${PUBLISH}" >> "$GITHUB_OUTPUT" + else + echo "${output}" + exit 1 + fi + - name: Prepare build matrix id: matrix uses: home-assistant/builder/actions/prepare-multi-arch-matrix@2026.03.2 @@ -91,13 +109,13 @@ jobs: io.hass.name=${{ needs.prepare.outputs.name }} io.hass.description=${{ needs.prepare.outputs.description }} ${{ needs.prepare.outputs.url && format('io.hass.url={0}', needs.prepare.outputs.url) || '' }} - push: ${{ inputs.publish }} + push: ${{ needs.prepare.outputs.publish == 'true' }} version: ${{ needs.prepare.outputs.version }} manifest: name: Publish multi-arch manifest needs: [prepare, build] - if: inputs.publish + if: needs.prepare.outputs.publish == 'true' runs-on: ubuntu-latest permissions: id-token: write From b5648ebf1c366eb8f8bb733b06ea0b0da7d94df8 Mon Sep 17 00:00:00 2001 From: puddly <32534428+puddly@users.noreply.github.com> Date: Sun, 15 Nov 2026 16:03:47 +0000 Subject: [PATCH 2/2] Build image name without quotes --- .github/workflows/build-app.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-app.yaml b/.github/workflows/build-app.yaml index 2efc554..782a5aa 100644 --- a/.github/workflows/build-app.yaml +++ b/.github/workflows/build-app.yaml @@ -55,7 +55,7 @@ jobs: - name: Skip publishing if the version is already published id: published env: - IMAGE: ${{ steps.info.outputs.image }} + IMAGE: ${{ steps.normalize.outputs.registry_prefix }}/${{ steps.normalize.outputs.image_name }} VERSION: ${{ steps.normalize.outputs.version }} PUBLISH: ${{ inputs.publish }} run: |