Drop deprecated architectures, build aarch64 on ARM runners #360
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build base images | |
| on: | |
| pull_request: | |
| branches: ["master"] | |
| release: | |
| types: ["published"] | |
| env: | |
| BUILD_TYPE: base | |
| ALPINE_LATEST: "3.22" | |
| DEBIAN_LATEST: "trixie" | |
| UBUNTU_LATEST: "24.04" | |
| PYTHON_LATEST: "3.13" | |
| jobs: | |
| init: | |
| name: Initialize build | |
| runs-on: &runs-on-ubuntu ubuntu-24.04 | |
| outputs: | |
| architectures_alpine: ${{ steps.info_alpine.outputs.architectures }} | |
| architectures_debian: ${{ steps.info_debian.outputs.architectures }} | |
| architectures_ubuntu: ${{ steps.info_ubuntu.outputs.architectures }} | |
| release: ${{ steps.version.outputs.version }} | |
| steps: | |
| - name: Checkout the repository | |
| uses: actions/[email protected] | |
| with: | |
| fetch-depth: 0 | |
| - name: Get information Alpine | |
| id: info_alpine | |
| uses: home-assistant/actions/helpers/info@master | |
| with: | |
| path: "${{ github.workspace }}/alpine" | |
| - name: Get information Debian | |
| id: info_debian | |
| uses: home-assistant/actions/helpers/info@master | |
| with: | |
| path: "${{ github.workspace }}/debian" | |
| - name: Get information Ubuntu | |
| id: info_ubuntu | |
| uses: home-assistant/actions/helpers/info@master | |
| with: | |
| path: "${{ github.workspace }}/ubuntu" | |
| - name: Get version | |
| id: version | |
| uses: home-assistant/actions/helpers/version@master | |
| with: | |
| type: ${{ env.BUILD_TYPE }} | |
| build_alpine: | |
| name: Build ${{ matrix.arch }} alpine ${{ matrix.version }} base image | |
| needs: init | |
| runs-on: ${{ matrix.os }} | |
| permissions: &permissions | |
| contents: read | |
| id-token: write | |
| packages: write | |
| strategy: | |
| matrix: | |
| arch: ${{ fromJson(needs.init.outputs.architectures_alpine) }} | |
| version: ["3.20", "3.21", "3.22"] | |
| include: &matrix-include-build | |
| - os: *runs-on-ubuntu | |
| - arch: aarch64 | |
| os: ubuntu-24.04-arm | |
| steps: | |
| - &checkout | |
| name: Checkout the repository | |
| uses: actions/[email protected] | |
| - &login-container-registry | |
| name: Login to GitHub Container Registry | |
| if: github.event_name == 'release' | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set build arguments | |
| shell: bash | |
| run: | | |
| if [[ "${{ github.event_name }}" == "release" ]]; then | |
| BUILD_ARGS="--additional-tag ${{ matrix.version }}-${{ github.event.release.tag_name }}" | |
| if [[ "${{ env.ALPINE_LATEST }}" != "${{ matrix.version }}" ]]; then | |
| BUILD_ARGS="$BUILD_ARGS --no-latest" | |
| fi | |
| else | |
| BUILD_ARGS="--test" | |
| fi | |
| echo "BUILD_ARGS=$BUILD_ARGS" >> $GITHUB_ENV | |
| - name: Build base image | |
| uses: home-assistant/[email protected] | |
| with: | |
| image: ${{ matrix.arch }} | |
| args: | | |
| $BUILD_ARGS \ | |
| --${{ matrix.arch }} \ | |
| --target /data/alpine \ | |
| --cosign \ | |
| --release ${{ needs.init.outputs.release }} \ | |
| --base ${{ matrix.version }} | |
| build_debian: | |
| name: Build ${{ matrix.arch }} debian ${{ matrix.version }} base image | |
| needs: init | |
| runs-on: ${{ matrix.os }} | |
| permissions: *permissions | |
| strategy: | |
| matrix: | |
| arch: ${{ fromJson(needs.init.outputs.architectures_debian) }} | |
| version: ["bookworm", "trixie"] | |
| include: *matrix-include-build | |
| steps: | |
| - *checkout | |
| - *login-container-registry | |
| - name: Set build arguments | |
| shell: bash | |
| run: | | |
| if [[ "${{ github.event_name }}" == "release" ]]; then | |
| BUILD_ARGS="--additional-tag ${{ matrix.version }}-${{ github.event.release.tag_name }}" | |
| if [[ "${{ env.DEBIAN_LATEST }}" != "${{ matrix.version }}" ]]; then | |
| BUILD_ARGS="$BUILD_ARGS --no-latest" | |
| fi | |
| else | |
| BUILD_ARGS="--test" | |
| fi | |
| echo "BUILD_ARGS=$BUILD_ARGS" >> $GITHUB_ENV | |
| - name: Build base image | |
| uses: home-assistant/[email protected] | |
| with: | |
| image: ${{ matrix.arch }} | |
| args: | | |
| $BUILD_ARGS \ | |
| --${{ matrix.arch }} \ | |
| --target /data/debian \ | |
| --cosign \ | |
| --release ${{ needs.init.outputs.release }} \ | |
| --version-from ${{ matrix.version }}-slim \ | |
| --base ${{ matrix.version }} | |
| build_ubuntu: | |
| name: Build ${{ matrix.arch }} ubuntu ${{ matrix.version }} base image | |
| needs: init | |
| runs-on: ${{ matrix.os }} | |
| permissions: *permissions | |
| strategy: | |
| matrix: | |
| arch: ${{ fromJson(needs.init.outputs.architectures_ubuntu) }} | |
| version: ["16.04", "18.04", "20.04", "22.04", "24.04"] | |
| include: *matrix-include-build | |
| steps: | |
| - *checkout | |
| - *login-container-registry | |
| - name: Set build arguments | |
| shell: bash | |
| run: | | |
| if [[ "${{ github.event_name }}" == "release" ]]; then | |
| BUILD_ARGS="--additional-tag ${{ matrix.version }}-${{ github.event.release.tag_name }}" | |
| if [[ "${{ env.UBUNTU_LATEST }}" != "${{ matrix.version }}" ]]; then | |
| BUILD_ARGS="$BUILD_ARGS --no-latest" | |
| fi | |
| else | |
| BUILD_ARGS="--test" | |
| fi | |
| echo "BUILD_ARGS=$BUILD_ARGS" >> $GITHUB_ENV | |
| - name: Build base image | |
| uses: home-assistant/[email protected] | |
| with: | |
| image: ${{ matrix.arch }} | |
| args: | | |
| $BUILD_ARGS \ | |
| --${{ matrix.arch }} \ | |
| --target /data/ubuntu \ | |
| --cosign \ | |
| --release ${{ needs.init.outputs.release }} \ | |
| --base ${{ matrix.version }} | |
| build_python: | |
| name: Build ${{ matrix.arch }} alpine ${{ matrix.version }} - python ${{ matrix.python }} base image | |
| needs: [init, build_alpine] | |
| runs-on: ${{ matrix.os }} | |
| permissions: *permissions | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| arch: ${{ fromJson(needs.init.outputs.architectures_alpine) }} | |
| version: ["3.20", "3.21", "3.22"] | |
| python: ["3.12", "3.13", "3.14"] | |
| include: *matrix-include-build | |
| steps: | |
| - *checkout | |
| - *login-container-registry | |
| - name: Set build arguments | |
| shell: bash | |
| run: | | |
| if [[ "${{ github.event_name }}" == "release" ]]; then | |
| BUILD_ARGS="--additional-tag ${{ matrix.python }}-alpine${{ matrix.version }}-${{ github.event.release.tag_name }}" | |
| if [[ "${{ env.ALPINE_LATEST }}" != "${{ matrix.version }}" ]] || [[ "${{ env.PYTHON_LATEST }}" != "${{ matrix.python }}" ]]; then | |
| BUILD_ARGS="$BUILD_ARGS --no-latest" | |
| fi | |
| else | |
| BUILD_ARGS="--test" | |
| fi | |
| echo "BUILD_ARGS=$BUILD_ARGS" >> $GITHUB_ENV | |
| - name: Build base image | |
| uses: home-assistant/[email protected] | |
| with: | |
| image: ${{ matrix.arch }} | |
| args: | | |
| $BUILD_ARGS \ | |
| --${{ matrix.arch }} \ | |
| --target "/data/python/${{ matrix.python }}" \ | |
| --cosign \ | |
| --release ${{ needs.init.outputs.release }} \ | |
| --version-from ${{ matrix.version }} \ | |
| --version ${{ matrix.python }} \ | |
| --base ${{ matrix.python }}-alpine${{ matrix.version }} |