Compare commits

...

8 Commits

Author SHA1 Message Date
Robert Resch 482d617441 Merge remote-tracking branch 'origin/dev' into edenhaus-translation-async 2026-04-14 12:12:45 +00:00
Robert Resch d5f9c8b14c fix 2026-04-14 12:10:19 +00:00
Robert Resch 14bef7a044 Use second job to add translations 2026-04-14 12:07:56 +00:00
Robert Resch ff9fe36a4d add version back 2026-04-14 11:37:20 +00:00
Robert Resch 5b4e9d75d6 Add translations later 2026-04-14 10:46:46 +00:00
Robert Resch a45a0f1469 Review findings and small improvements 2026-04-14 08:31:04 +00:00
Robert Resch aae63cb397 Adjust docker file to be multistage 2026-03-27 17:32:58 +01:00
Robert Resch 78aa5b9913 Improve build pipeline by triggering translation download async 2026-03-27 17:01:58 +01:00
4 changed files with 113 additions and 38 deletions
+92 -38
View File
@@ -66,24 +66,8 @@ jobs:
exit 1
fi
- name: Download Translations
run: python3 -m script.translations download
env:
LOKALISE_TOKEN: ${{ secrets.LOKALISE_TOKEN }} # zizmor: ignore[secrets-outside-env]
- name: Archive translations
shell: bash
run: find ./homeassistant/components/*/translations -name "*.json" | tar zcvf translations.tar.gz -T -
- name: Upload translations
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: translations
path: translations.tar.gz
if-no-files-found: error
build_base:
name: Build ${{ matrix.arch }} base core image
name: Build ${{ matrix.arch }} base core image without translations
if: github.repository_owner == 'home-assistant'
needs: init
runs-on: ${{ matrix.os }}
@@ -177,22 +161,12 @@ jobs:
sed -i "s|home-assistant-intents==.*||" requirements_all.txt requirements.txt
fi
- name: Download translations
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: translations
- name: Extract translations
run: |
tar xvf translations.tar.gz
rm translations.tar.gz
- name: Write meta info file
shell: bash
run: |
echo "${GITHUB_SHA};${GITHUB_REF};${GITHUB_EVENT_NAME};${GITHUB_ACTOR}" > rootfs/OFFICIAL_IMAGE
- name: Build base image
- name: Build base image without translations
uses: home-assistant/builder/actions/build-image@62a1597b84b3461abad9816d9cd92862a2b542c3 # 2026.03.2
with:
arch: ${{ matrix.arch }}
@@ -202,6 +176,87 @@ jobs:
container-registry-password: ${{ secrets.GITHUB_TOKEN }}
cosign-base-identity: "https://github.com/home-assistant/docker/.*"
cosign-base-verify: ghcr.io/home-assistant/${{ matrix.arch }}-homeassistant-base:${{ needs.init.outputs.base_image_version }}
image: ghcr.io/home-assistant/${{ matrix.arch }}-homeassistant-no-translations
image-tags: ${{ needs.init.outputs.version }}
push: true
version: ${{ needs.init.outputs.version }}
download_translations:
name: Download translations
needs: init
if: github.repository_owner == 'home-assistant'
runs-on: ubuntu-latest
permissions:
contents: read # To check out the repository
steps:
- name: Checkout the repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version-file: ".python-version"
- name: Download Translations
run: python3 -m script.translations download
env:
LOKALISE_TOKEN: ${{ secrets.LOKALISE_TOKEN }} # zizmor: ignore[secrets-outside-env]
- name: Archive translations
shell: bash
run: find ./homeassistant/components/*/translations -name "*.json" | tar zcvf translations.tar.gz -T -
- name: Upload translations
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: translations
path: translations.tar.gz
if-no-files-found: error
build_translations:
name: Build ${{ matrix.arch }} core image with translations
if: github.repository_owner == 'home-assistant'
needs: ["init", "build_base", "download_translations"]
runs-on: ${{ matrix.os }}
permissions:
contents: read # To check out the repository
packages: write # To push to GHCR
id-token: write # For cosign signing
strategy:
fail-fast: false
matrix:
arch: ${{ fromJson(needs.init.outputs.architectures) }}
include:
- arch: amd64
os: ubuntu-24.04
- arch: aarch64
os: ubuntu-24.04-arm
steps:
- name: Checkout the repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Download translations artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: translations
path: build/translations-output
- name: Build translations image
uses: home-assistant/builder/actions/build-image@62a1597b84b3461abad9816d9cd92862a2b542c3 # 2026.03.2
with:
arch: ${{ matrix.arch }}
build-args: |
BUILD_FROM=ghcr.io/home-assistant/${{ matrix.arch }}-homeassistant-no-translations:${{ needs.init.outputs.version }}
cache-gha: false
container-registry-password: ${{ secrets.GITHUB_TOKEN }}
context: build/translations-output
cosign-base-identity: "https://github.com/home-assistant/core/.*"
cosign-base-verify: ghcr.io/home-assistant/${{ matrix.arch }}-homeassistant-no-translations:${{ needs.init.outputs.version }}
file: Dockerfile.translations
image: ghcr.io/home-assistant/${{ matrix.arch }}-homeassistant
image-tags: ${{ needs.init.outputs.version }}
push: true
@@ -210,7 +265,7 @@ jobs:
build_machine:
name: Build ${{ matrix.machine }} machine core image
if: github.repository_owner == 'home-assistant'
needs: ["init", "build_base"]
needs: ["init", "build_translations"]
runs-on: ${{ matrix.runs-on }}
permissions:
contents: read # To check out the repository
@@ -326,7 +381,7 @@ jobs:
name: Publish meta container for ${{ matrix.registry }}
environment: ${{ needs.init.outputs.channel }}
if: github.repository_owner == 'home-assistant'
needs: ["init", "build_base"]
needs: ["init", "build_translations"]
runs-on: ubuntu-latest
permissions:
contents: read # To check out the repository
@@ -463,7 +518,7 @@ jobs:
build_python:
name: Build PyPi package
environment: ${{ needs.init.outputs.channel }}
needs: ["init", "build_base"]
needs: ["init", "download_translations"]
runs-on: ubuntu-latest
permissions:
contents: read # To check out the repository
@@ -481,14 +536,13 @@ jobs:
python-version-file: ".python-version"
- name: Download translations
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: translations
- name: Extract translations
shell: bash
env:
LOKALISE_TOKEN: ${{ secrets.LOKALISE_TOKEN }} # zizmor: ignore[secrets-outside-env]
TRANSLATION_PROCESS_ID: ${{ needs.init.outputs.translation_download_process }}
run: |
tar xvf translations.tar.gz
rm translations.tar.gz
pip install -r script/translations/requirements.txt
python3 -u -m script.translations download --process-id "$TRANSLATION_PROCESS_ID"
- name: Build package
shell: bash
+1
View File
@@ -323,6 +323,7 @@ jobs:
file:
- Dockerfile
- Dockerfile.dev
- Dockerfile.translations
- script/hassfest/docker/Dockerfile
steps:
- name: Check out code from GitHub
+7
View File
@@ -0,0 +1,7 @@
# Automatically generated by hassfest.
#
# To update, run python3 -m script.hassfest -p docker
ARG BUILD_FROM
FROM ${BUILD_FROM}
COPY homeassistant/ /usr/src/homeassistant/homeassistant/
+13
View File
@@ -76,6 +76,15 @@ RUN \
WORKDIR /config
"""
DOCKERFILE_TRANSLATIONS_TEMPLATE = r"""# Automatically generated by hassfest.
#
# To update, run python3 -m script.hassfest -p docker
ARG BUILD_FROM
FROM ${{BUILD_FROM}}
COPY homeassistant/ /usr/src/homeassistant/homeassistant/
"""
@dataclass(frozen=True)
class _MachineConfig:
@@ -234,6 +243,10 @@ def _generate_files(config: Config) -> list[File]:
),
config.root / "Dockerfile",
),
File(
DOCKERFILE_TRANSLATIONS_TEMPLATE.format(),
config.root / "Dockerfile.translations",
),
File(
_HASSFEST_TEMPLATE.format(
timeout=timeout,