Nightly build Docker #331
This file contains 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: Nightly build Docker | |
on: | |
workflow_dispatch: null | |
schedule: | |
- cron: '22 1 * * *' | |
env: | |
REGISTRY: ghcr.io | |
jobs: | |
matrix: | |
runs-on: ubuntu-latest | |
name: Get matrix from json | |
outputs: | |
matrix: ${{ steps.vars.outputs.matrix }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up variables | |
id: vars | |
run: echo "matrix=$(jq -c . matrix.json)" >> $GITHUB_OUTPUT | |
build: | |
runs-on: ubuntu-latest | |
name: Build for ${{ matrix.image_name }} | |
needs: [matrix] | |
strategy: | |
max-parallel: 2 | |
matrix: ${{ fromJson(needs.matrix.outputs.matrix) }} | |
steps: | |
- name: Set up QEMU | |
uses: docker/[email protected] | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Cache Docker layers | |
uses: actions/[email protected] | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ matrix.image_name }}-nightly-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx-${{ matrix.image_name }}-nightly- | |
- name: Log in to the Container registry | |
uses: docker/[email protected] | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build | |
uses: docker/[email protected] | |
with: | |
push: false | |
load: true | |
tags: | | |
${{ env.REGISTRY }}/congatudo/congatudo-nightly:${{ matrix.image_name }}-latest | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache-new | |
build-args: | | |
"BUILD_FROM=${{ matrix.build_from }}" | |
"PKG_TARGET=${{ matrix.pkg_target }}" | |
"PKG_OPTIONS=${{ matrix.pkg_options }}" | |
- name: Push | |
run: | | |
docker push ${{ env.REGISTRY }}/congatudo/congatudo-nightly:${{ matrix.image_name }}-latest | |
- name: Move cache | |
run: | | |
rm -rf /tmp/.buildx-cache | |
mv /tmp/.buildx-cache-new /tmp/.buildx-cache | |
manifest: | |
runs-on: ubuntu-latest | |
name: Create and push manifest | |
needs: [build] | |
steps: | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Log in to the Container registry | |
uses: docker/[email protected] | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create manifest | |
run: | | |
# TODO: Use matrix here. | |
docker manifest create ${{ env.REGISTRY }}/congatudo/congatudo-nightly:alpine-latest \ | |
--amend ${{ env.REGISTRY }}/congatudo/congatudo-nightly:alpine-armv7-latest \ | |
--amend ${{ env.REGISTRY }}/congatudo/congatudo-nightly:alpine-aarch64-latest \ | |
--amend ${{ env.REGISTRY }}/congatudo/congatudo-nightly:alpine-amd64-latest | |
docker manifest create ${{ env.REGISTRY }}/congatudo/congatudo-nightly:homeassistant-latest \ | |
--amend ${{ env.REGISTRY }}/congatudo/congatudo-nightly:homeassistant-armhf-latest \ | |
--amend ${{ env.REGISTRY }}/congatudo/congatudo-nightly:homeassistant-armv7-latest \ | |
--amend ${{ env.REGISTRY }}/congatudo/congatudo-nightly:homeassistant-aarch64-latest \ | |
--amend ${{ env.REGISTRY }}/congatudo/congatudo-nightly:homeassistant-amd64-latest | |
- name: Push manifest | |
run: | | |
# TODO: Use matrix here. | |
docker manifest push ${{ env.REGISTRY }}/congatudo/congatudo-nightly:alpine-latest | |
docker manifest push ${{ env.REGISTRY }}/congatudo/congatudo-nightly:homeassistant-latest |